diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 8fcf5148bcd8..d519fa200f0f 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -395,6 +395,7 @@ com.azure.resourcemanager:azure-resourcemanager-billingbenefits;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-providerhub;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-reservations;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-storagemover;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-newrelic;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/pom.xml b/pom.xml index d3b512dfab72..a93c8369910b 100644 --- a/pom.xml +++ b/pom.xml @@ -120,6 +120,7 @@ sdk/mysqlflexibleserver sdk/netapp sdk/networkfunction + sdk/newrelic sdk/nginx sdk/notificationhubs sdk/oep diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/CHANGELOG.md b/sdk/newrelic/azure-resourcemanager-newrelic/CHANGELOG.md new file mode 100644 index 000000000000..c926fa0ef924 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-02-08) + +- Azure Resource Manager NewRelic client library for Java. This package contains Microsoft Azure SDK for NewRelic Management SDK. Package tag package-2022-07-01-preview. 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/newrelic/azure-resourcemanager-newrelic/README.md b/sdk/newrelic/azure-resourcemanager-newrelic/README.md new file mode 100644 index 000000000000..1887003c4d29 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager NewRelic client library for Java + +Azure Resource Manager NewRelic client library for Java. + +This package contains Microsoft Azure SDK for NewRelic Management SDK. Package tag package-2022-07-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-newrelic;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-newrelic + 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(); +NewRelicManager manager = NewRelicManager + .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/newrelic/azure-resourcemanager-newrelic/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/newrelic/azure-resourcemanager-newrelic/SAMPLE.md b/sdk/newrelic/azure-resourcemanager-newrelic/SAMPLE.md new file mode 100644 index 000000000000..1fb810c38e20 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/SAMPLE.md @@ -0,0 +1,1046 @@ +# Code snippets and samples + + +## Accounts + +- [List](#accounts_list) + +## Monitors + +- [CreateOrUpdate](#monitors_createorupdate) +- [Delete](#monitors_delete) +- [GetByResourceGroup](#monitors_getbyresourcegroup) +- [GetMetricRules](#monitors_getmetricrules) +- [GetMetricStatus](#monitors_getmetricstatus) +- [List](#monitors_list) +- [ListAppServices](#monitors_listappservices) +- [ListByResourceGroup](#monitors_listbyresourcegroup) +- [ListHosts](#monitors_listhosts) +- [ListMonitoredResources](#monitors_listmonitoredresources) +- [SwitchBilling](#monitors_switchbilling) +- [Update](#monitors_update) +- [VmHostPayload](#monitors_vmhostpayload) + +## Operations + +- [List](#operations_list) + +## Organizations + +- [List](#organizations_list) + +## Plans + +- [List](#plans_list) + +## TagRules + +- [CreateOrUpdate](#tagrules_createorupdate) +- [Delete](#tagrules_delete) +- [Get](#tagrules_get) +- [ListByNewRelicMonitorResource](#tagrules_listbynewrelicmonitorresource) +- [Update](#tagrules_update) +### Accounts_List + +```java +/** Samples for Accounts List. */ +public final class AccountsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MinimumSet_Gen.json + */ + /** + * Sample code: Accounts_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void accountsListMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.accounts().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MaximumSet_Gen.json + */ + /** + * Sample code: Accounts_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void accountsListMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.accounts().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_CreateOrUpdate + +```java +import com.azure.resourcemanager.newrelic.models.AccountCreationSource; +import com.azure.resourcemanager.newrelic.models.AccountInfo; +import com.azure.resourcemanager.newrelic.models.BillingCycle; +import com.azure.resourcemanager.newrelic.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelic.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelic.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelic.models.NewRelicSingleSignOnProperties; +import com.azure.resourcemanager.newrelic.models.OrgCreationSource; +import com.azure.resourcemanager.newrelic.models.OrganizationInfo; +import com.azure.resourcemanager.newrelic.models.PlanData; +import com.azure.resourcemanager.newrelic.models.ProvisioningState; +import com.azure.resourcemanager.newrelic.models.SingleSignOnStates; +import com.azure.resourcemanager.newrelic.models.UsageType; +import com.azure.resourcemanager.newrelic.models.UserAssignedIdentity; +import com.azure.resourcemanager.newrelic.models.UserInfo; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Monitors CreateOrUpdate. */ +public final class MonitorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsCreateOrUpdateMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .define("cdlymktqw") + .withRegion("k") + .withExistingResourceGroup("rgNewRelic") + .withTags(mapOf("key6976", "oaxfhf")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("key8903", new UserAssignedIdentity()))) + .withNewRelicAccountProperties( + new NewRelicAccountProperties() + .withUserId("vcscxlncofcuduadesd") + .withAccountInfo( + new AccountInfo() + .withAccountId("xhqmg") + .withIngestionKey("fakeTokenPlaceholder") + .withRegion("ljcf")) + .withOrganizationInfo(new OrganizationInfo().withOrganizationId("k")) + .withSingleSignOnProperties( + new NewRelicSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.INITIAL) + .withEnterpriseAppId("kwiwfz") + .withSingleSignOnUrl("kvseueuljsxmfwpqctz") + .withProvisioningState(ProvisioningState.ACCEPTED))) + .withUserInfo( + new UserInfo() + .withFirstName("vdftzcggirefejajwahhwhyibutramdaotvnuf") + .withLastName("bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc") + .withEmailAddress("%6%@4-g.N1.3F-kI1.Ue-.lJso") + .withPhoneNumber("krf") + .withCountry("hslqnwdanrconqyekwbnttaetv")) + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("tbbiaga") + .withEffectiveDate(OffsetDateTime.parse("2022-12-05T14:11:37.786Z"))) + .withOrgCreationSource(OrgCreationSource.LIFTR) + .withAccountCreationSource(AccountCreationSource.LIFTR) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Monitors_Delete + +```java +/** Samples for Monitors Delete. */ +public final class MonitorsDeleteSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_Delete_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsDeleteMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.monitors().delete("rgopenapi", null, "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_Delete_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsDeleteMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .delete( + "rgopenapi", + "ruxvg@xqkmdhrnoo.hlmbpm", + "ipxmlcbonyxtolzejcjshkmlron", + com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_GetByResourceGroup + +```java +/** Samples for Monitors GetByResourceGroup. */ +public final class MonitorsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_Get_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsGetMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.monitors().getByResourceGroupWithResponse("rgNewRelic", "cdlymktqw", com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_GetMetricRules + +```java +import com.azure.resourcemanager.newrelic.models.MetricsRequest; + +/** Samples for Monitors GetMetricRules. */ +public final class MonitorsGetMetricRulesSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricRules_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsGetMetricRulesMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .getMetricRulesWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricRules_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsGetMetricRulesMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .getMetricRulesWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_GetMetricStatus + +```java +import com.azure.resourcemanager.newrelic.models.MetricsStatusRequest; +import java.util.Arrays; + +/** Samples for Monitors GetMetricStatus. */ +public final class MonitorsGetMetricStatusSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricStatus_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsGetMetricStatusMinimumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .getMetricStatusWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsStatusRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricStatus_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsGetMetricStatusMaximumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .getMetricStatusWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsStatusRequest() + .withAzureResourceIds(Arrays.asList("enfghpfw")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_List + +```java +/** Samples for Monitors List. */ +public final class MonitorsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListBySubscription_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListBySubscriptionMaximumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.monitors().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_ListAppServices + +```java +import com.azure.resourcemanager.newrelic.models.AppServicesGetRequest; +import java.util.Arrays; + +/** Samples for Monitors ListAppServices. */ +public final class MonitorsListAppServicesSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListAppServices_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListAppServicesMaximumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .listAppServices( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new AppServicesGetRequest() + .withAzureResourceIds(Arrays.asList("pvzrksrmzowobuhxpwiotnpcvjbu")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_ListAppServices_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListAppServicesMinimumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .listAppServices( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new AppServicesGetRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_ListByResourceGroup + +```java +/** Samples for Monitors ListByResourceGroup. */ +public final class MonitorsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListByResourceGroup_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListByResourceGroupMaximumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.monitors().listByResourceGroup("rgNewRelic", com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_ListHosts + +```java +import com.azure.resourcemanager.newrelic.models.HostsGetRequest; +import java.util.Arrays; + +/** Samples for Monitors ListHosts. */ +public final class MonitorsListHostsSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_ListHosts_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListHostsMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .listHosts( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + new HostsGetRequest() + .withVmIds(Arrays.asList("xzphvxvfmvjrnsgyns")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListHosts_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListHostsMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .listHosts( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + new HostsGetRequest() + .withVmIds(Arrays.asList("xzphvxvfmvjrnsgyns")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_ListMonitoredResources + +```java +/** Samples for Monitors ListMonitoredResources. */ +public final class MonitorsListMonitoredResourcesSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_ListMonitoredResources_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListMonitoredResourcesMinimumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .listMonitoredResources("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListMonitoredResources_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListMonitoredResourcesMaximumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .listMonitoredResources("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_SwitchBilling + +```java +import com.azure.resourcemanager.newrelic.models.BillingCycle; +import com.azure.resourcemanager.newrelic.models.PlanData; +import com.azure.resourcemanager.newrelic.models.SwitchBillingRequest; +import com.azure.resourcemanager.newrelic.models.UsageType; +import java.time.OffsetDateTime; + +/** Samples for Monitors SwitchBilling. */ +public final class MonitorsSwitchBillingSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_SwitchBilling_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsSwitchBillingMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .switchBillingWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new SwitchBillingRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_SwitchBilling_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsSwitchBillingMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .switchBillingWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new SwitchBillingRequest() + .withAzureResourceId("enfghpfw") + .withOrganizationId("k") + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("tbbiaga") + .withEffectiveDate(OffsetDateTime.parse("2022-12-05T14:11:37.786Z"))) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_Update + +```java +import com.azure.resourcemanager.newrelic.models.AccountCreationSource; +import com.azure.resourcemanager.newrelic.models.AccountInfo; +import com.azure.resourcemanager.newrelic.models.BillingCycle; +import com.azure.resourcemanager.newrelic.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelic.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelic.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelic.models.NewRelicMonitorResource; +import com.azure.resourcemanager.newrelic.models.NewRelicSingleSignOnProperties; +import com.azure.resourcemanager.newrelic.models.OrgCreationSource; +import com.azure.resourcemanager.newrelic.models.OrganizationInfo; +import com.azure.resourcemanager.newrelic.models.PlanData; +import com.azure.resourcemanager.newrelic.models.ProvisioningState; +import com.azure.resourcemanager.newrelic.models.SingleSignOnStates; +import com.azure.resourcemanager.newrelic.models.UsageType; +import com.azure.resourcemanager.newrelic.models.UserAssignedIdentity; +import com.azure.resourcemanager.newrelic.models.UserInfo; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Monitors Update. */ +public final class MonitorsUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_Update_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsUpdateMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + NewRelicMonitorResource resource = + manager + .monitors() + .getByResourceGroupWithResponse("rgNewRelic", "cdlymktqw", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key164", "jqakdrrmmyzytqu")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("key8903", new UserAssignedIdentity()))) + .withNewRelicAccountProperties( + new NewRelicAccountProperties() + .withUserId("vcscxlncofcuduadesd") + .withAccountInfo( + new AccountInfo() + .withAccountId("xhqmg") + .withIngestionKey("fakeTokenPlaceholder") + .withRegion("ljcf")) + .withOrganizationInfo(new OrganizationInfo().withOrganizationId("k")) + .withSingleSignOnProperties( + new NewRelicSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.INITIAL) + .withEnterpriseAppId("kwiwfz") + .withSingleSignOnUrl("kvseueuljsxmfwpqctz") + .withProvisioningState(ProvisioningState.ACCEPTED))) + .withUserInfo( + new UserInfo() + .withFirstName("vdftzcggirefejajwahhwhyibutramdaotvnuf") + .withLastName("bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc") + .withEmailAddress("%6%@4-g.N1.3F-kI1.Ue-.lJso") + .withPhoneNumber("krf") + .withCountry("hslqnwdanrconqyekwbnttaetv")) + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("tbbiaga") + .withEffectiveDate(OffsetDateTime.parse("2022-12-05T14:11:37.786Z"))) + .withOrgCreationSource(OrgCreationSource.LIFTR) + .withAccountCreationSource(AccountCreationSource.LIFTR) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Monitors_VmHostPayload + +```java +/** Samples for Monitors VmHostPayload. */ +public final class MonitorsVmHostPayloadSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_VmHostPayload_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsVmHostPayloadMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .vmHostPayloadWithResponse("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_VmHostPayload_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsVmHostPayloadMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .vmHostPayloadWithResponse("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void operationsListMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void operationsListMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Organizations_List + +```java +/** Samples for Organizations List. */ +public final class OrganizationsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Organizations_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void organizationsListMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.organizations().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void organizationsListMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.organizations().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } +} +``` + +### Plans_List + +```java +/** Samples for Plans List. */ +public final class PlansListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MaximumSet_Gen.json + */ + /** + * Sample code: Plans_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void plansListMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.plans().list("pwuxgvrmkk", "hilawwjz", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MinimumSet_Gen.json + */ + /** + * Sample code: Plans_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void plansListMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.plans().list(null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### TagRules_CreateOrUpdate + +```java +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelic.models.FilteringTag; +import com.azure.resourcemanager.newrelic.models.LogRules; +import com.azure.resourcemanager.newrelic.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelic.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelic.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelic.models.TagAction; +import java.util.Arrays; + +/** Samples for TagRules CreateOrUpdate. */ +public final class TagRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesCreateOrUpdateMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .define("bxcantgzggsepbhqmedjqyrqeezmfb") + .withExistingMonitor("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron") + .withLogRules( + new LogRules() + .withSendAadLogs(SendAadLogsStatus.ENABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.ENABLED) + .withSendActivityLogs(SendActivityLogsStatus.ENABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE)))) + .withMetricRules( + new MetricRulesInner() + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE))) + .withUserEmail("test@testing.com")) + .create(); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_CreateOrUpdate_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesCreateOrUpdateMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .define("bxcantgzggsepbhqmedjqyrqeezmfb") + .withExistingMonitor("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron") + .create(); + } +} +``` + +### TagRules_Delete + +```java +/** Samples for TagRules Delete. */ +public final class TagRulesDeleteSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_Delete_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesDeleteMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .delete( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_Delete_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesDeleteMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .delete( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } +} +``` + +### TagRules_Get + +```java +/** Samples for TagRules Get. */ +public final class TagRulesGetSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_Get_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesGetMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_Get_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesGetMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } +} +``` + +### TagRules_ListByNewRelicMonitorResource + +```java +/** Samples for TagRules ListByNewRelicMonitorResource. */ +public final class TagRulesListByNewRelicMonitorResourceSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_ListByNewRelicMonitorResource_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesListByNewRelicMonitorResourceMinimumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .listByNewRelicMonitorResource( + "rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_ListByNewRelicMonitorResource_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesListByNewRelicMonitorResourceMaximumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .listByNewRelicMonitorResource( + "rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } +} +``` + +### TagRules_Update + +```java +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelic.models.FilteringTag; +import com.azure.resourcemanager.newrelic.models.LogRules; +import com.azure.resourcemanager.newrelic.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelic.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelic.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelic.models.TagAction; +import com.azure.resourcemanager.newrelic.models.TagRule; +import java.util.Arrays; + +/** Samples for TagRules Update. */ +public final class TagRulesUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_Update_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesUpdateMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + TagRule resource = + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withLogRules( + new LogRules() + .withSendAadLogs(SendAadLogsStatus.ENABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.ENABLED) + .withSendActivityLogs(SendActivityLogsStatus.ENABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE)))) + .withMetricRules( + new MetricRulesInner() + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE))) + .withUserEmail("test@testing.com")) + .apply(); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_Update_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesUpdateMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + TagRule resource = + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/pom.xml b/sdk/newrelic/azure-resourcemanager-newrelic/pom.xml new file mode 100644 index 000000000000..864e5230c556 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-newrelic + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for NewRelic Management + This package contains Microsoft Azure SDK for NewRelic Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2022-07-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.36.0 + + + com.azure + azure-core-management + 1.10.1 + + + diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/NewRelicManager.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/NewRelicManager.java new file mode 100644 index 000000000000..054a21808626 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/NewRelicManager.java @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic; + +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.newrelic.fluent.NewRelicObservability; +import com.azure.resourcemanager.newrelic.implementation.AccountsImpl; +import com.azure.resourcemanager.newrelic.implementation.MonitorsImpl; +import com.azure.resourcemanager.newrelic.implementation.NewRelicObservabilityBuilder; +import com.azure.resourcemanager.newrelic.implementation.OperationsImpl; +import com.azure.resourcemanager.newrelic.implementation.OrganizationsImpl; +import com.azure.resourcemanager.newrelic.implementation.PlansImpl; +import com.azure.resourcemanager.newrelic.implementation.TagRulesImpl; +import com.azure.resourcemanager.newrelic.models.Accounts; +import com.azure.resourcemanager.newrelic.models.Monitors; +import com.azure.resourcemanager.newrelic.models.Operations; +import com.azure.resourcemanager.newrelic.models.Organizations; +import com.azure.resourcemanager.newrelic.models.Plans; +import com.azure.resourcemanager.newrelic.models.TagRules; +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 NewRelicManager. */ +public final class NewRelicManager { + private Operations operations; + + private Accounts accounts; + + private Monitors monitors; + + private Organizations organizations; + + private Plans plans; + + private TagRules tagRules; + + private final NewRelicObservability clientObject; + + private NewRelicManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new NewRelicObservabilityBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of NewRelic service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the NewRelic service API instance. + */ + public static NewRelicManager 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 NewRelic service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the NewRelic service API instance. + */ + public static NewRelicManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new NewRelicManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create NewRelicManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new NewRelicManager.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 NewRelic service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the NewRelic service API instance. + */ + public NewRelicManager 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.newrelic") + .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 NewRelicManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of Accounts. + * + * @return Resource collection API of Accounts. + */ + public Accounts accounts() { + if (this.accounts == null) { + this.accounts = new AccountsImpl(clientObject.getAccounts(), this); + } + return accounts; + } + + /** + * Gets the resource collection API of Monitors. It manages NewRelicMonitorResource. + * + * @return Resource collection API of Monitors. + */ + public Monitors monitors() { + if (this.monitors == null) { + this.monitors = new MonitorsImpl(clientObject.getMonitors(), this); + } + return monitors; + } + + /** + * Gets the resource collection API of Organizations. + * + * @return Resource collection API of Organizations. + */ + public Organizations organizations() { + if (this.organizations == null) { + this.organizations = new OrganizationsImpl(clientObject.getOrganizations(), this); + } + return organizations; + } + + /** + * Gets the resource collection API of Plans. + * + * @return Resource collection API of Plans. + */ + public Plans plans() { + if (this.plans == null) { + this.plans = new PlansImpl(clientObject.getPlans(), this); + } + return plans; + } + + /** + * Gets the resource collection API of TagRules. It manages TagRule. + * + * @return Resource collection API of TagRules. + */ + public TagRules tagRules() { + if (this.tagRules == null) { + this.tagRules = new TagRulesImpl(clientObject.getTagRules(), this); + } + return tagRules; + } + + /** + * @return Wrapped service client NewRelicObservability providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public NewRelicObservability serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/AccountsClient.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/AccountsClient.java new file mode 100644 index 000000000000..b7640f313ece --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/AccountsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelic.fluent.models.AccountResourceInner; + +/** An instance of this class provides access to all the operations defined in AccountsClient. */ +public interface AccountsClient { + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String userEmail, String location); + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String userEmail, String location, Context context); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/MonitorsClient.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/MonitorsClient.java new file mode 100644 index 000000000000..99c6e2288968 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/MonitorsClient.java @@ -0,0 +1,467 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.newrelic.fluent.models.AppServiceInfoInner; +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelic.fluent.models.MetricsStatusResponseInner; +import com.azure.resourcemanager.newrelic.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.newrelic.fluent.models.NewRelicMonitorResourceInner; +import com.azure.resourcemanager.newrelic.fluent.models.VMExtensionPayloadInner; +import com.azure.resourcemanager.newrelic.fluent.models.VMInfoInner; +import com.azure.resourcemanager.newrelic.models.AppServicesGetRequest; +import com.azure.resourcemanager.newrelic.models.HostsGetRequest; +import com.azure.resourcemanager.newrelic.models.MetricsRequest; +import com.azure.resourcemanager.newrelic.models.MetricsStatusRequest; +import com.azure.resourcemanager.newrelic.models.NewRelicMonitorResourceUpdate; +import com.azure.resourcemanager.newrelic.models.SwitchBillingRequest; + +/** An instance of this class provides access to all the operations defined in MonitorsClient. */ +public interface MonitorsClient { + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context); + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NewRelicMonitorResourceInner getByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NewRelicMonitorResourceInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource); + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NewRelicMonitorResourceInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context); + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NewRelicMonitorResourceInner createOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource); + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NewRelicMonitorResourceInner createOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context); + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties, Context context); + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NewRelicMonitorResourceInner update( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties); + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String userEmail, String monitorName); + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String userEmail, String monitorName, Context context); + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String userEmail, String monitorName); + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String userEmail, String monitorName, Context context); + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric rules along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMetricRulesWithResponse( + String resourceGroupName, String monitorName, MetricsRequest request, Context context); + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetricRulesInner getMetricRules(String resourceGroupName, String monitorName, MetricsRequest request); + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMetricStatusWithResponse( + String resourceGroupName, String monitorName, MetricsStatusRequest request, Context context); + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetricsStatusResponseInner getMetricStatus( + String resourceGroupName, String monitorName, MetricsStatusRequest request); + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get 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 response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request); + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get 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 response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request, Context context); + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing 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 switchBillingWithResponse( + String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context); + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing 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 switchBilling(String resourceGroupName, String monitorName, SwitchBillingRequest request); + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get 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 response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listHosts(String resourceGroupName, String monitorName, HostsGetRequest request); + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get 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 response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listHosts( + String resourceGroupName, String monitorName, HostsGetRequest request, Context context); + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMonitoredResources(String resourceGroupName, String monitorName); + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, Context context); + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of payload to be passed while installing VM agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response vmHostPayloadWithResponse( + String resourceGroupName, String monitorName, Context context); + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of payload to be passed while installing VM agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VMExtensionPayloadInner vmHostPayload(String resourceGroupName, String monitorName); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/NewRelicObservability.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/NewRelicObservability.java new file mode 100644 index 000000000000..134ffb9d8e77 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/NewRelicObservability.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for NewRelicObservability class. */ +public interface NewRelicObservability { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * 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 OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + AccountsClient getAccounts(); + + /** + * Gets the MonitorsClient object to access its operations. + * + * @return the MonitorsClient object. + */ + MonitorsClient getMonitors(); + + /** + * Gets the OrganizationsClient object to access its operations. + * + * @return the OrganizationsClient object. + */ + OrganizationsClient getOrganizations(); + + /** + * Gets the PlansClient object to access its operations. + * + * @return the PlansClient object. + */ + PlansClient getPlans(); + + /** + * Gets the TagRulesClient object to access its operations. + * + * @return the TagRulesClient object. + */ + TagRulesClient getTagRules(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/OperationsClient.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/OperationsClient.java new file mode 100644 index 000000000000..a322afb2216b --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/OperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelic.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/OrganizationsClient.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/OrganizationsClient.java new file mode 100644 index 000000000000..bbdd9a20cb1b --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/OrganizationsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelic.fluent.models.OrganizationResourceInner; + +/** An instance of this class provides access to all the operations defined in OrganizationsClient. */ +public interface OrganizationsClient { + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String userEmail, String location); + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String userEmail, String location, Context context); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/PlansClient.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/PlansClient.java new file mode 100644 index 000000000000..28eff2f0a9bb --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/PlansClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelic.fluent.models.PlanDataResourceInner; + +/** An instance of this class provides access to all the operations defined in PlansClient. */ +public interface PlansClient { + /** + * List plans data. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization 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 response of get all plan data Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String accountId, String organizationId, Context context); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/TagRulesClient.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/TagRulesClient.java new file mode 100644 index 000000000000..df15b6713585 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/TagRulesClient.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.newrelic.fluent.models.TagRuleInner; +import com.azure.resourcemanager.newrelic.fluent.models.TagRuleUpdateInner; + +/** An instance of this class provides access to all the operations defined in TagRulesClient. */ +public interface TagRulesClient { + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByNewRelicMonitorResource(String resourceGroupName, String monitorName); + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByNewRelicMonitorResource( + String resourceGroupName, String monitorName, Context context); + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context); + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagRuleInner get(String resourceGroupName, String monitorName, String ruleSetName); + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TagRuleInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource); + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TagRuleInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context); + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagRuleInner createOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource); + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagRuleInner createOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context); + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName, String ruleSetName); + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String monitorName, String ruleSetName, Context context); + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String monitorName, String ruleSetName); + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String monitorName, String ruleSetName, Context context); + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String monitorName, + String ruleSetName, + TagRuleUpdateInner properties, + Context context); + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagRuleInner update( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleUpdateInner properties); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/AccountProperties.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/AccountProperties.java new file mode 100644 index 000000000000..7afd9f85fc18 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/AccountProperties.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** List of all the New relic accounts for the given user. */ +@Fluent +public final class AccountProperties { + /* + * organization id + */ + @JsonProperty(value = "organizationId") + private String organizationId; + + /* + * account id + */ + @JsonProperty(value = "accountId") + private String accountId; + + /* + * account name + */ + @JsonProperty(value = "accountName") + private String accountName; + + /* + * region + */ + @JsonProperty(value = "region") + private String region; + + /** Creates an instance of AccountProperties class. */ + public AccountProperties() { + } + + /** + * Get the organizationId property: organization id. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.organizationId; + } + + /** + * Set the organizationId property: organization id. + * + * @param organizationId the organizationId value to set. + * @return the AccountProperties object itself. + */ + public AccountProperties withOrganizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Get the accountId property: account id. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Set the accountId property: account id. + * + * @param accountId the accountId value to set. + * @return the AccountProperties object itself. + */ + public AccountProperties withAccountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Get the accountName property: account name. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Set the accountName property: account name. + * + * @param accountName the accountName value to set. + * @return the AccountProperties object itself. + */ + public AccountProperties withAccountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the region property: region. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Set the region property: region. + * + * @param region the region value to set. + * @return the AccountProperties object itself. + */ + public AccountProperties withRegion(String region) { + this.region = region; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/AccountResourceInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/AccountResourceInner.java new file mode 100644 index 000000000000..48b7f27f9bd9 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/AccountResourceInner.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The details of a account resource. */ +@Fluent +public final class AccountResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private AccountProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of AccountResourceInner class. */ + public AccountResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private AccountProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the organizationId property: organization id. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.innerProperties() == null ? null : this.innerProperties().organizationId(); + } + + /** + * Set the organizationId property: organization id. + * + * @param organizationId the organizationId value to set. + * @return the AccountResourceInner object itself. + */ + public AccountResourceInner withOrganizationId(String organizationId) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountProperties(); + } + this.innerProperties().withOrganizationId(organizationId); + return this; + } + + /** + * Get the accountId property: account id. + * + * @return the accountId value. + */ + public String accountId() { + return this.innerProperties() == null ? null : this.innerProperties().accountId(); + } + + /** + * Set the accountId property: account id. + * + * @param accountId the accountId value to set. + * @return the AccountResourceInner object itself. + */ + public AccountResourceInner withAccountId(String accountId) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountProperties(); + } + this.innerProperties().withAccountId(accountId); + return this; + } + + /** + * Get the accountName property: account name. + * + * @return the accountName value. + */ + public String accountName() { + return this.innerProperties() == null ? null : this.innerProperties().accountName(); + } + + /** + * Set the accountName property: account name. + * + * @param accountName the accountName value to set. + * @return the AccountResourceInner object itself. + */ + public AccountResourceInner withAccountName(String accountName) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountProperties(); + } + this.innerProperties().withAccountName(accountName); + return this; + } + + /** + * Get the region property: region. + * + * @return the region value. + */ + public String region() { + return this.innerProperties() == null ? null : this.innerProperties().region(); + } + + /** + * Set the region property: region. + * + * @param region the region value to set. + * @return the AccountResourceInner object itself. + */ + public AccountResourceInner withRegion(String region) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountProperties(); + } + this.innerProperties().withRegion(region); + 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/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/AppServiceInfoInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/AppServiceInfoInner.java new file mode 100644 index 000000000000..839d5e4f08ba --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/AppServiceInfoInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of VM Resource having NewRelic OneAgent installed. */ +@Fluent +public final class AppServiceInfoInner { + /* + * Azure App service resource ID + */ + @JsonProperty(value = "azureResourceId") + private String azureResourceId; + + /* + * Version of the NewRelic agent installed on the App service. + */ + @JsonProperty(value = "agentVersion") + private String agentVersion; + + /* + * Status of the NewRelic agent installed on the App service. + */ + @JsonProperty(value = "agentStatus") + private String agentStatus; + + /** Creates an instance of AppServiceInfoInner class. */ + public AppServiceInfoInner() { + } + + /** + * Get the azureResourceId property: Azure App service resource ID. + * + * @return the azureResourceId value. + */ + public String azureResourceId() { + return this.azureResourceId; + } + + /** + * Set the azureResourceId property: Azure App service resource ID. + * + * @param azureResourceId the azureResourceId value to set. + * @return the AppServiceInfoInner object itself. + */ + public AppServiceInfoInner withAzureResourceId(String azureResourceId) { + this.azureResourceId = azureResourceId; + return this; + } + + /** + * Get the agentVersion property: Version of the NewRelic agent installed on the App service. + * + * @return the agentVersion value. + */ + public String agentVersion() { + return this.agentVersion; + } + + /** + * Set the agentVersion property: Version of the NewRelic agent installed on the App service. + * + * @param agentVersion the agentVersion value to set. + * @return the AppServiceInfoInner object itself. + */ + public AppServiceInfoInner withAgentVersion(String agentVersion) { + this.agentVersion = agentVersion; + return this; + } + + /** + * Get the agentStatus property: Status of the NewRelic agent installed on the App service. + * + * @return the agentStatus value. + */ + public String agentStatus() { + return this.agentStatus; + } + + /** + * Set the agentStatus property: Status of the NewRelic agent installed on the App service. + * + * @param agentStatus the agentStatus value to set. + * @return the AppServiceInfoInner object itself. + */ + public AppServiceInfoInner withAgentStatus(String agentStatus) { + this.agentStatus = agentStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MetricRulesInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MetricRulesInner.java new file mode 100644 index 000000000000..45f3a42cb6f4 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MetricRulesInner.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelic.models.FilteringTag; +import com.azure.resourcemanager.newrelic.models.SendMetricsStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Set of rules for sending metrics for the Monitor resource. */ +@Fluent +public final class MetricRulesInner { + /* + * Flag specifying if metrics should be sent for the Monitor resource. + */ + @JsonProperty(value = "sendMetrics") + private SendMetricsStatus sendMetrics; + + /* + * List of filtering tags to be used for capturing metrics. + */ + @JsonProperty(value = "filteringTags") + private List filteringTags; + + /* + * User Email + */ + @JsonProperty(value = "userEmail") + private String userEmail; + + /** Creates an instance of MetricRulesInner class. */ + public MetricRulesInner() { + } + + /** + * Get the sendMetrics property: Flag specifying if metrics should be sent for the Monitor resource. + * + * @return the sendMetrics value. + */ + public SendMetricsStatus sendMetrics() { + return this.sendMetrics; + } + + /** + * Set the sendMetrics property: Flag specifying if metrics should be sent for the Monitor resource. + * + * @param sendMetrics the sendMetrics value to set. + * @return the MetricRulesInner object itself. + */ + public MetricRulesInner withSendMetrics(SendMetricsStatus sendMetrics) { + this.sendMetrics = sendMetrics; + return this; + } + + /** + * Get the filteringTags property: List of filtering tags to be used for capturing metrics. + * + * @return the filteringTags value. + */ + public List filteringTags() { + return this.filteringTags; + } + + /** + * Set the filteringTags property: List of filtering tags to be used for capturing metrics. + * + * @param filteringTags the filteringTags value to set. + * @return the MetricRulesInner object itself. + */ + public MetricRulesInner withFilteringTags(List filteringTags) { + this.filteringTags = filteringTags; + return this; + } + + /** + * Get the userEmail property: User Email. + * + * @return the userEmail value. + */ + public String userEmail() { + return this.userEmail; + } + + /** + * Set the userEmail property: User Email. + * + * @param userEmail the userEmail value to set. + * @return the MetricRulesInner object itself. + */ + public MetricRulesInner withUserEmail(String userEmail) { + this.userEmail = userEmail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (filteringTags() != null) { + filteringTags().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MetricsStatusResponseInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MetricsStatusResponseInner.java new file mode 100644 index 000000000000..58f29ac7c7ef --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MetricsStatusResponseInner.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of get metrics status Operation. */ +@Fluent +public final class MetricsStatusResponseInner { + /* + * Azure resource IDs + */ + @JsonProperty(value = "azureResourceIds") + private List azureResourceIds; + + /** Creates an instance of MetricsStatusResponseInner class. */ + public MetricsStatusResponseInner() { + } + + /** + * Get the azureResourceIds property: Azure resource IDs. + * + * @return the azureResourceIds value. + */ + public List azureResourceIds() { + return this.azureResourceIds; + } + + /** + * Set the azureResourceIds property: Azure resource IDs. + * + * @param azureResourceIds the azureResourceIds value to set. + * @return the MetricsStatusResponseInner object itself. + */ + public MetricsStatusResponseInner withAzureResourceIds(List azureResourceIds) { + this.azureResourceIds = azureResourceIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MonitorProperties.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MonitorProperties.java new file mode 100644 index 000000000000..3f772f8bfa60 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MonitorProperties.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelic.models.AccountCreationSource; +import com.azure.resourcemanager.newrelic.models.LiftrResourceCategories; +import com.azure.resourcemanager.newrelic.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.newrelic.models.MonitoringStatus; +import com.azure.resourcemanager.newrelic.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelic.models.OrgCreationSource; +import com.azure.resourcemanager.newrelic.models.PlanData; +import com.azure.resourcemanager.newrelic.models.ProvisioningState; +import com.azure.resourcemanager.newrelic.models.UserInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties specific to the NewRelic Monitor resource. */ +@Fluent +public final class MonitorProperties { + /* + * Provisioning State of the resource + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * MonitoringStatus of the resource + */ + @JsonProperty(value = "monitoringStatus", access = JsonProperty.Access.WRITE_ONLY) + private MonitoringStatus monitoringStatus; + + /* + * NewRelic Organization properties of the resource + */ + @JsonProperty(value = "marketplaceSubscriptionStatus", access = JsonProperty.Access.WRITE_ONLY) + private MarketplaceSubscriptionStatus marketplaceSubscriptionStatus; + + /* + * Marketplace Subscription Id + */ + @JsonProperty(value = "marketplaceSubscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String marketplaceSubscriptionId; + + /* + * MarketplaceSubscriptionStatus of the resource + */ + @JsonProperty(value = "newRelicAccountProperties") + private NewRelicAccountProperties newRelicAccountProperties; + + /* + * User Info + */ + @JsonProperty(value = "userInfo") + private UserInfo userInfo; + + /* + * Plan details + */ + @JsonProperty(value = "planData") + private PlanData planData; + + /* + * Liftr resource category + */ + @JsonProperty(value = "liftrResourceCategory", access = JsonProperty.Access.WRITE_ONLY) + private LiftrResourceCategories liftrResourceCategory; + + /* + * Liftr resource preference. The priority of the resource. + */ + @JsonProperty(value = "liftrResourcePreference", access = JsonProperty.Access.WRITE_ONLY) + private Integer liftrResourcePreference; + + /* + * Source of org creation + */ + @JsonProperty(value = "orgCreationSource") + private OrgCreationSource orgCreationSource; + + /* + * Source of account creation + */ + @JsonProperty(value = "accountCreationSource") + private AccountCreationSource accountCreationSource; + + /** Creates an instance of MonitorProperties class. */ + public MonitorProperties() { + } + + /** + * Get the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the monitoringStatus property: MonitoringStatus of the resource. + * + * @return the monitoringStatus value. + */ + public MonitoringStatus monitoringStatus() { + return this.monitoringStatus; + } + + /** + * Get the marketplaceSubscriptionStatus property: NewRelic Organization properties of the resource. + * + * @return the marketplaceSubscriptionStatus value. + */ + public MarketplaceSubscriptionStatus marketplaceSubscriptionStatus() { + return this.marketplaceSubscriptionStatus; + } + + /** + * Get the marketplaceSubscriptionId property: Marketplace Subscription Id. + * + * @return the marketplaceSubscriptionId value. + */ + public String marketplaceSubscriptionId() { + return this.marketplaceSubscriptionId; + } + + /** + * Get the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @return the newRelicAccountProperties value. + */ + public NewRelicAccountProperties newRelicAccountProperties() { + return this.newRelicAccountProperties; + } + + /** + * Set the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @param newRelicAccountProperties the newRelicAccountProperties value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withNewRelicAccountProperties(NewRelicAccountProperties newRelicAccountProperties) { + this.newRelicAccountProperties = newRelicAccountProperties; + return this; + } + + /** + * Get the userInfo property: User Info. + * + * @return the userInfo value. + */ + public UserInfo userInfo() { + return this.userInfo; + } + + /** + * Set the userInfo property: User Info. + * + * @param userInfo the userInfo value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withUserInfo(UserInfo userInfo) { + this.userInfo = userInfo; + return this; + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.planData; + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withPlanData(PlanData planData) { + this.planData = planData; + return this; + } + + /** + * Get the liftrResourceCategory property: Liftr resource category. + * + * @return the liftrResourceCategory value. + */ + public LiftrResourceCategories liftrResourceCategory() { + return this.liftrResourceCategory; + } + + /** + * Get the liftrResourcePreference property: Liftr resource preference. The priority of the resource. + * + * @return the liftrResourcePreference value. + */ + public Integer liftrResourcePreference() { + return this.liftrResourcePreference; + } + + /** + * Get the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + public OrgCreationSource orgCreationSource() { + return this.orgCreationSource; + } + + /** + * Set the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource the orgCreationSource value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withOrgCreationSource(OrgCreationSource orgCreationSource) { + this.orgCreationSource = orgCreationSource; + return this; + } + + /** + * Get the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + public AccountCreationSource accountCreationSource() { + return this.accountCreationSource; + } + + /** + * Set the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource the accountCreationSource value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withAccountCreationSource(AccountCreationSource accountCreationSource) { + this.accountCreationSource = accountCreationSource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (newRelicAccountProperties() != null) { + newRelicAccountProperties().validate(); + } + if (userInfo() != null) { + userInfo().validate(); + } + if (planData() != null) { + planData().validate(); + } + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MonitoredResourceInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MonitoredResourceInner.java new file mode 100644 index 000000000000..184a895aeef7 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MonitoredResourceInner.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelic.models.SendingLogsStatus; +import com.azure.resourcemanager.newrelic.models.SendingMetricsStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of resource being monitored by NewRelic monitor resource. */ +@Fluent +public final class MonitoredResourceInner { + /* + * The ARM id of the resource. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Flag indicating if resource is sending metrics to NewRelic. + */ + @JsonProperty(value = "sendingMetrics") + private SendingMetricsStatus sendingMetrics; + + /* + * Reason for why the resource is sending metrics (or why it is not sending). + */ + @JsonProperty(value = "reasonForMetricsStatus") + private String reasonForMetricsStatus; + + /* + * Flag indicating if resource is sending logs to NewRelic. + */ + @JsonProperty(value = "sendingLogs") + private SendingLogsStatus sendingLogs; + + /* + * Reason for why the resource is sending logs (or why it is not sending). + */ + @JsonProperty(value = "reasonForLogsStatus") + private String reasonForLogsStatus; + + /** Creates an instance of MonitoredResourceInner class. */ + public MonitoredResourceInner() { + } + + /** + * Get the id property: The ARM id of the resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM id of the resource. + * + * @param id the id value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the sendingMetrics property: Flag indicating if resource is sending metrics to NewRelic. + * + * @return the sendingMetrics value. + */ + public SendingMetricsStatus sendingMetrics() { + return this.sendingMetrics; + } + + /** + * Set the sendingMetrics property: Flag indicating if resource is sending metrics to NewRelic. + * + * @param sendingMetrics the sendingMetrics value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withSendingMetrics(SendingMetricsStatus sendingMetrics) { + this.sendingMetrics = sendingMetrics; + return this; + } + + /** + * Get the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not + * sending). + * + * @return the reasonForMetricsStatus value. + */ + public String reasonForMetricsStatus() { + return this.reasonForMetricsStatus; + } + + /** + * Set the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not + * sending). + * + * @param reasonForMetricsStatus the reasonForMetricsStatus value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withReasonForMetricsStatus(String reasonForMetricsStatus) { + this.reasonForMetricsStatus = reasonForMetricsStatus; + return this; + } + + /** + * Get the sendingLogs property: Flag indicating if resource is sending logs to NewRelic. + * + * @return the sendingLogs value. + */ + public SendingLogsStatus sendingLogs() { + return this.sendingLogs; + } + + /** + * Set the sendingLogs property: Flag indicating if resource is sending logs to NewRelic. + * + * @param sendingLogs the sendingLogs value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withSendingLogs(SendingLogsStatus sendingLogs) { + this.sendingLogs = sendingLogs; + return this; + } + + /** + * Get the reasonForLogsStatus property: Reason for why the resource is sending logs (or why it is not sending). + * + * @return the reasonForLogsStatus value. + */ + public String reasonForLogsStatus() { + return this.reasonForLogsStatus; + } + + /** + * Set the reasonForLogsStatus property: Reason for why the resource is sending logs (or why it is not sending). + * + * @param reasonForLogsStatus the reasonForLogsStatus value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withReasonForLogsStatus(String reasonForLogsStatus) { + this.reasonForLogsStatus = reasonForLogsStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MonitoringTagRulesPropertiesInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MonitoringTagRulesPropertiesInner.java new file mode 100644 index 000000000000..917e768739b7 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/MonitoringTagRulesPropertiesInner.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelic.models.LogRules; +import com.azure.resourcemanager.newrelic.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource-specific properties for this resource. */ +@Fluent +public final class MonitoringTagRulesPropertiesInner { + /* + * Provisioning State of the resource + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Set of rules for sending logs for the Monitor resource. + */ + @JsonProperty(value = "logRules") + private LogRules logRules; + + /* + * Set of rules for sending metrics for the Monitor resource. + */ + @JsonProperty(value = "metricRules") + private MetricRulesInner metricRules; + + /** Creates an instance of MonitoringTagRulesPropertiesInner class. */ + public MonitoringTagRulesPropertiesInner() { + } + + /** + * Get the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + public LogRules logRules() { + return this.logRules; + } + + /** + * Set the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @param logRules the logRules value to set. + * @return the MonitoringTagRulesPropertiesInner object itself. + */ + public MonitoringTagRulesPropertiesInner withLogRules(LogRules logRules) { + this.logRules = logRules; + return this; + } + + /** + * Get the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + public MetricRulesInner metricRules() { + return this.metricRules; + } + + /** + * Set the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @param metricRules the metricRules value to set. + * @return the MonitoringTagRulesPropertiesInner object itself. + */ + public MonitoringTagRulesPropertiesInner withMetricRules(MetricRulesInner metricRules) { + this.metricRules = metricRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logRules() != null) { + logRules().validate(); + } + if (metricRules() != null) { + metricRules().validate(); + } + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/NewRelicMonitorResourceInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/NewRelicMonitorResourceInner.java new file mode 100644 index 000000000000..479dc2ad3c01 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/NewRelicMonitorResourceInner.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.models.AccountCreationSource; +import com.azure.resourcemanager.newrelic.models.LiftrResourceCategories; +import com.azure.resourcemanager.newrelic.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelic.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.newrelic.models.MonitoringStatus; +import com.azure.resourcemanager.newrelic.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelic.models.OrgCreationSource; +import com.azure.resourcemanager.newrelic.models.PlanData; +import com.azure.resourcemanager.newrelic.models.ProvisioningState; +import com.azure.resourcemanager.newrelic.models.UserInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A Monitor Resource by NewRelic. */ +@Fluent +public final class NewRelicMonitorResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties", required = true) + private MonitorProperties innerProperties = new MonitorProperties(); + + /* + * The managed service identities assigned to this resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of NewRelicMonitorResourceInner class. */ + public NewRelicMonitorResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private MonitorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the NewRelicMonitorResourceInner object itself. + */ + public NewRelicMonitorResourceInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public NewRelicMonitorResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public NewRelicMonitorResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the monitoringStatus property: MonitoringStatus of the resource. + * + * @return the monitoringStatus value. + */ + public MonitoringStatus monitoringStatus() { + return this.innerProperties() == null ? null : this.innerProperties().monitoringStatus(); + } + + /** + * Get the marketplaceSubscriptionStatus property: NewRelic Organization properties of the resource. + * + * @return the marketplaceSubscriptionStatus value. + */ + public MarketplaceSubscriptionStatus marketplaceSubscriptionStatus() { + return this.innerProperties() == null ? null : this.innerProperties().marketplaceSubscriptionStatus(); + } + + /** + * Get the marketplaceSubscriptionId property: Marketplace Subscription Id. + * + * @return the marketplaceSubscriptionId value. + */ + public String marketplaceSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().marketplaceSubscriptionId(); + } + + /** + * Get the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @return the newRelicAccountProperties value. + */ + public NewRelicAccountProperties newRelicAccountProperties() { + return this.innerProperties() == null ? null : this.innerProperties().newRelicAccountProperties(); + } + + /** + * Set the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @param newRelicAccountProperties the newRelicAccountProperties value to set. + * @return the NewRelicMonitorResourceInner object itself. + */ + public NewRelicMonitorResourceInner withNewRelicAccountProperties( + NewRelicAccountProperties newRelicAccountProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withNewRelicAccountProperties(newRelicAccountProperties); + return this; + } + + /** + * Get the userInfo property: User Info. + * + * @return the userInfo value. + */ + public UserInfo userInfo() { + return this.innerProperties() == null ? null : this.innerProperties().userInfo(); + } + + /** + * Set the userInfo property: User Info. + * + * @param userInfo the userInfo value to set. + * @return the NewRelicMonitorResourceInner object itself. + */ + public NewRelicMonitorResourceInner withUserInfo(UserInfo userInfo) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withUserInfo(userInfo); + return this; + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.innerProperties() == null ? null : this.innerProperties().planData(); + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the NewRelicMonitorResourceInner object itself. + */ + public NewRelicMonitorResourceInner withPlanData(PlanData planData) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withPlanData(planData); + return this; + } + + /** + * Get the liftrResourceCategory property: Liftr resource category. + * + * @return the liftrResourceCategory value. + */ + public LiftrResourceCategories liftrResourceCategory() { + return this.innerProperties() == null ? null : this.innerProperties().liftrResourceCategory(); + } + + /** + * Get the liftrResourcePreference property: Liftr resource preference. The priority of the resource. + * + * @return the liftrResourcePreference value. + */ + public Integer liftrResourcePreference() { + return this.innerProperties() == null ? null : this.innerProperties().liftrResourcePreference(); + } + + /** + * Get the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + public OrgCreationSource orgCreationSource() { + return this.innerProperties() == null ? null : this.innerProperties().orgCreationSource(); + } + + /** + * Set the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource the orgCreationSource value to set. + * @return the NewRelicMonitorResourceInner object itself. + */ + public NewRelicMonitorResourceInner withOrgCreationSource(OrgCreationSource orgCreationSource) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withOrgCreationSource(orgCreationSource); + return this; + } + + /** + * Get the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + public AccountCreationSource accountCreationSource() { + return this.innerProperties() == null ? null : this.innerProperties().accountCreationSource(); + } + + /** + * Set the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource the accountCreationSource value to set. + * @return the NewRelicMonitorResourceInner object itself. + */ + public NewRelicMonitorResourceInner withAccountCreationSource(AccountCreationSource accountCreationSource) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withAccountCreationSource(accountCreationSource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model NewRelicMonitorResourceInner")); + } else { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NewRelicMonitorResourceInner.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/NewRelicMonitorResourceUpdateProperties.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/NewRelicMonitorResourceUpdateProperties.java new file mode 100644 index 000000000000..fa5a286a644c --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/NewRelicMonitorResourceUpdateProperties.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelic.models.AccountCreationSource; +import com.azure.resourcemanager.newrelic.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelic.models.OrgCreationSource; +import com.azure.resourcemanager.newrelic.models.PlanData; +import com.azure.resourcemanager.newrelic.models.UserInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The updatable properties of the NewRelicMonitorResource. */ +@Fluent +public final class NewRelicMonitorResourceUpdateProperties { + /* + * MarketplaceSubscriptionStatus of the resource + */ + @JsonProperty(value = "newRelicAccountProperties") + private NewRelicAccountProperties newRelicAccountProperties; + + /* + * User Info + */ + @JsonProperty(value = "userInfo") + private UserInfo userInfo; + + /* + * Plan details + */ + @JsonProperty(value = "planData") + private PlanData planData; + + /* + * Source of org creation + */ + @JsonProperty(value = "orgCreationSource") + private OrgCreationSource orgCreationSource; + + /* + * Source of account creation + */ + @JsonProperty(value = "accountCreationSource") + private AccountCreationSource accountCreationSource; + + /** Creates an instance of NewRelicMonitorResourceUpdateProperties class. */ + public NewRelicMonitorResourceUpdateProperties() { + } + + /** + * Get the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @return the newRelicAccountProperties value. + */ + public NewRelicAccountProperties newRelicAccountProperties() { + return this.newRelicAccountProperties; + } + + /** + * Set the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @param newRelicAccountProperties the newRelicAccountProperties value to set. + * @return the NewRelicMonitorResourceUpdateProperties object itself. + */ + public NewRelicMonitorResourceUpdateProperties withNewRelicAccountProperties( + NewRelicAccountProperties newRelicAccountProperties) { + this.newRelicAccountProperties = newRelicAccountProperties; + return this; + } + + /** + * Get the userInfo property: User Info. + * + * @return the userInfo value. + */ + public UserInfo userInfo() { + return this.userInfo; + } + + /** + * Set the userInfo property: User Info. + * + * @param userInfo the userInfo value to set. + * @return the NewRelicMonitorResourceUpdateProperties object itself. + */ + public NewRelicMonitorResourceUpdateProperties withUserInfo(UserInfo userInfo) { + this.userInfo = userInfo; + return this; + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.planData; + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the NewRelicMonitorResourceUpdateProperties object itself. + */ + public NewRelicMonitorResourceUpdateProperties withPlanData(PlanData planData) { + this.planData = planData; + return this; + } + + /** + * Get the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + public OrgCreationSource orgCreationSource() { + return this.orgCreationSource; + } + + /** + * Set the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource the orgCreationSource value to set. + * @return the NewRelicMonitorResourceUpdateProperties object itself. + */ + public NewRelicMonitorResourceUpdateProperties withOrgCreationSource(OrgCreationSource orgCreationSource) { + this.orgCreationSource = orgCreationSource; + return this; + } + + /** + * Get the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + public AccountCreationSource accountCreationSource() { + return this.accountCreationSource; + } + + /** + * Set the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource the accountCreationSource value to set. + * @return the NewRelicMonitorResourceUpdateProperties object itself. + */ + public NewRelicMonitorResourceUpdateProperties withAccountCreationSource( + AccountCreationSource accountCreationSource) { + this.accountCreationSource = accountCreationSource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (newRelicAccountProperties() != null) { + newRelicAccountProperties().validate(); + } + if (userInfo() != null) { + userInfo().validate(); + } + if (planData() != null) { + planData().validate(); + } + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/OperationInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/OperationInner.java new file mode 100644 index 000000000000..06597852c486 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/OperationInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelic.models.ActionType; +import com.azure.resourcemanager.newrelic.models.OperationDisplay; +import com.azure.resourcemanager.newrelic.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + *

Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/OrganizationProperties.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/OrganizationProperties.java new file mode 100644 index 000000000000..a61147db87a4 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/OrganizationProperties.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.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelic.models.BillingSource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of Organizations. */ +@Fluent +public final class OrganizationProperties { + /* + * organization id + */ + @JsonProperty(value = "organizationId") + private String organizationId; + + /* + * organization name + */ + @JsonProperty(value = "organizationName") + private String organizationName; + + /* + * Billing source + */ + @JsonProperty(value = "billingSource") + private BillingSource billingSource; + + /** Creates an instance of OrganizationProperties class. */ + public OrganizationProperties() { + } + + /** + * Get the organizationId property: organization id. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.organizationId; + } + + /** + * Set the organizationId property: organization id. + * + * @param organizationId the organizationId value to set. + * @return the OrganizationProperties object itself. + */ + public OrganizationProperties withOrganizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Get the organizationName property: organization name. + * + * @return the organizationName value. + */ + public String organizationName() { + return this.organizationName; + } + + /** + * Set the organizationName property: organization name. + * + * @param organizationName the organizationName value to set. + * @return the OrganizationProperties object itself. + */ + public OrganizationProperties withOrganizationName(String organizationName) { + this.organizationName = organizationName; + return this; + } + + /** + * Get the billingSource property: Billing source. + * + * @return the billingSource value. + */ + public BillingSource billingSource() { + return this.billingSource; + } + + /** + * Set the billingSource property: Billing source. + * + * @param billingSource the billingSource value to set. + * @return the OrganizationProperties object itself. + */ + public OrganizationProperties withBillingSource(BillingSource billingSource) { + this.billingSource = billingSource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/OrganizationResourceInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/OrganizationResourceInner.java new file mode 100644 index 000000000000..a23877d73a53 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/OrganizationResourceInner.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelic.models.BillingSource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The details of a Organization resource. */ +@Fluent +public final class OrganizationResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private OrganizationProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of OrganizationResourceInner class. */ + public OrganizationResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private OrganizationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the organizationId property: organization id. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.innerProperties() == null ? null : this.innerProperties().organizationId(); + } + + /** + * Set the organizationId property: organization id. + * + * @param organizationId the organizationId value to set. + * @return the OrganizationResourceInner object itself. + */ + public OrganizationResourceInner withOrganizationId(String organizationId) { + if (this.innerProperties() == null) { + this.innerProperties = new OrganizationProperties(); + } + this.innerProperties().withOrganizationId(organizationId); + return this; + } + + /** + * Get the organizationName property: organization name. + * + * @return the organizationName value. + */ + public String organizationName() { + return this.innerProperties() == null ? null : this.innerProperties().organizationName(); + } + + /** + * Set the organizationName property: organization name. + * + * @param organizationName the organizationName value to set. + * @return the OrganizationResourceInner object itself. + */ + public OrganizationResourceInner withOrganizationName(String organizationName) { + if (this.innerProperties() == null) { + this.innerProperties = new OrganizationProperties(); + } + this.innerProperties().withOrganizationName(organizationName); + return this; + } + + /** + * Get the billingSource property: Billing source. + * + * @return the billingSource value. + */ + public BillingSource billingSource() { + return this.innerProperties() == null ? null : this.innerProperties().billingSource(); + } + + /** + * Set the billingSource property: Billing source. + * + * @param billingSource the billingSource value to set. + * @return the OrganizationResourceInner object itself. + */ + public OrganizationResourceInner withBillingSource(BillingSource billingSource) { + if (this.innerProperties() == null) { + this.innerProperties = new OrganizationProperties(); + } + this.innerProperties().withBillingSource(billingSource); + 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/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/PlanDataProperties.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/PlanDataProperties.java new file mode 100644 index 000000000000..d35620d2ed25 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/PlanDataProperties.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelic.models.AccountCreationSource; +import com.azure.resourcemanager.newrelic.models.OrgCreationSource; +import com.azure.resourcemanager.newrelic.models.PlanData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Plan details. */ +@Fluent +public final class PlanDataProperties { + /* + * Plan details + */ + @JsonProperty(value = "planData") + private PlanData planData; + + /* + * Source of org creation + */ + @JsonProperty(value = "orgCreationSource") + private OrgCreationSource orgCreationSource; + + /* + * Source of account creation + */ + @JsonProperty(value = "accountCreationSource") + private AccountCreationSource accountCreationSource; + + /** Creates an instance of PlanDataProperties class. */ + public PlanDataProperties() { + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.planData; + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the PlanDataProperties object itself. + */ + public PlanDataProperties withPlanData(PlanData planData) { + this.planData = planData; + return this; + } + + /** + * Get the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + public OrgCreationSource orgCreationSource() { + return this.orgCreationSource; + } + + /** + * Set the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource the orgCreationSource value to set. + * @return the PlanDataProperties object itself. + */ + public PlanDataProperties withOrgCreationSource(OrgCreationSource orgCreationSource) { + this.orgCreationSource = orgCreationSource; + return this; + } + + /** + * Get the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + public AccountCreationSource accountCreationSource() { + return this.accountCreationSource; + } + + /** + * Set the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource the accountCreationSource value to set. + * @return the PlanDataProperties object itself. + */ + public PlanDataProperties withAccountCreationSource(AccountCreationSource accountCreationSource) { + this.accountCreationSource = accountCreationSource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (planData() != null) { + planData().validate(); + } + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/PlanDataResourceInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/PlanDataResourceInner.java new file mode 100644 index 000000000000..140b16067b6f --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/PlanDataResourceInner.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelic.models.AccountCreationSource; +import com.azure.resourcemanager.newrelic.models.OrgCreationSource; +import com.azure.resourcemanager.newrelic.models.PlanData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The details of a PlanData resource. */ +@Fluent +public final class PlanDataResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private PlanDataProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of PlanDataResourceInner class. */ + public PlanDataResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private PlanDataProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.innerProperties() == null ? null : this.innerProperties().planData(); + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the PlanDataResourceInner object itself. + */ + public PlanDataResourceInner withPlanData(PlanData planData) { + if (this.innerProperties() == null) { + this.innerProperties = new PlanDataProperties(); + } + this.innerProperties().withPlanData(planData); + return this; + } + + /** + * Get the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + public OrgCreationSource orgCreationSource() { + return this.innerProperties() == null ? null : this.innerProperties().orgCreationSource(); + } + + /** + * Set the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource the orgCreationSource value to set. + * @return the PlanDataResourceInner object itself. + */ + public PlanDataResourceInner withOrgCreationSource(OrgCreationSource orgCreationSource) { + if (this.innerProperties() == null) { + this.innerProperties = new PlanDataProperties(); + } + this.innerProperties().withOrgCreationSource(orgCreationSource); + return this; + } + + /** + * Get the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + public AccountCreationSource accountCreationSource() { + return this.innerProperties() == null ? null : this.innerProperties().accountCreationSource(); + } + + /** + * Set the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource the accountCreationSource value to set. + * @return the PlanDataResourceInner object itself. + */ + public PlanDataResourceInner withAccountCreationSource(AccountCreationSource accountCreationSource) { + if (this.innerProperties() == null) { + this.innerProperties = new PlanDataProperties(); + } + this.innerProperties().withAccountCreationSource(accountCreationSource); + 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/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/TagRuleInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/TagRuleInner.java new file mode 100644 index 000000000000..193160eed329 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/TagRuleInner.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.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.models.LogRules; +import com.azure.resourcemanager.newrelic.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A tag rule belonging to NewRelic account. */ +@Fluent +public final class TagRuleInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties", required = true) + private MonitoringTagRulesPropertiesInner innerProperties = new MonitoringTagRulesPropertiesInner(); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of TagRuleInner class. */ + public TagRuleInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private MonitoringTagRulesPropertiesInner innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + public LogRules logRules() { + return this.innerProperties() == null ? null : this.innerProperties().logRules(); + } + + /** + * Set the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @param logRules the logRules value to set. + * @return the TagRuleInner object itself. + */ + public TagRuleInner withLogRules(LogRules logRules) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitoringTagRulesPropertiesInner(); + } + this.innerProperties().withLogRules(logRules); + return this; + } + + /** + * Get the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + public MetricRulesInner metricRules() { + return this.innerProperties() == null ? null : this.innerProperties().metricRules(); + } + + /** + * Set the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @param metricRules the metricRules value to set. + * @return the TagRuleInner object itself. + */ + public TagRuleInner withMetricRules(MetricRulesInner metricRules) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitoringTagRulesPropertiesInner(); + } + this.innerProperties().withMetricRules(metricRules); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property innerProperties in model TagRuleInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TagRuleInner.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/TagRuleUpdateInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/TagRuleUpdateInner.java new file mode 100644 index 000000000000..f93fe77341ec --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/TagRuleUpdateInner.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelic.models.LogRules; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The type used for update operations of the TagRule. */ +@Fluent +public final class TagRuleUpdateInner { + /* + * The updatable properties of the TagRule. + */ + @JsonProperty(value = "properties") + private TagRuleUpdatePropertiesInner innerProperties; + + /** Creates an instance of TagRuleUpdateInner class. */ + public TagRuleUpdateInner() { + } + + /** + * Get the innerProperties property: The updatable properties of the TagRule. + * + * @return the innerProperties value. + */ + private TagRuleUpdatePropertiesInner innerProperties() { + return this.innerProperties; + } + + /** + * Get the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + public LogRules logRules() { + return this.innerProperties() == null ? null : this.innerProperties().logRules(); + } + + /** + * Set the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @param logRules the logRules value to set. + * @return the TagRuleUpdateInner object itself. + */ + public TagRuleUpdateInner withLogRules(LogRules logRules) { + if (this.innerProperties() == null) { + this.innerProperties = new TagRuleUpdatePropertiesInner(); + } + this.innerProperties().withLogRules(logRules); + return this; + } + + /** + * Get the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + public MetricRulesInner metricRules() { + return this.innerProperties() == null ? null : this.innerProperties().metricRules(); + } + + /** + * Set the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @param metricRules the metricRules value to set. + * @return the TagRuleUpdateInner object itself. + */ + public TagRuleUpdateInner withMetricRules(MetricRulesInner metricRules) { + if (this.innerProperties() == null) { + this.innerProperties = new TagRuleUpdatePropertiesInner(); + } + this.innerProperties().withMetricRules(metricRules); + 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/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/TagRuleUpdatePropertiesInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/TagRuleUpdatePropertiesInner.java new file mode 100644 index 000000000000..ab54e14f51f4 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/TagRuleUpdatePropertiesInner.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelic.models.LogRules; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The updatable properties of the TagRule. */ +@Fluent +public final class TagRuleUpdatePropertiesInner { + /* + * Set of rules for sending logs for the Monitor resource. + */ + @JsonProperty(value = "logRules") + private LogRules logRules; + + /* + * Set of rules for sending metrics for the Monitor resource. + */ + @JsonProperty(value = "metricRules") + private MetricRulesInner metricRules; + + /** Creates an instance of TagRuleUpdatePropertiesInner class. */ + public TagRuleUpdatePropertiesInner() { + } + + /** + * Get the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + public LogRules logRules() { + return this.logRules; + } + + /** + * Set the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @param logRules the logRules value to set. + * @return the TagRuleUpdatePropertiesInner object itself. + */ + public TagRuleUpdatePropertiesInner withLogRules(LogRules logRules) { + this.logRules = logRules; + return this; + } + + /** + * Get the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + public MetricRulesInner metricRules() { + return this.metricRules; + } + + /** + * Set the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @param metricRules the metricRules value to set. + * @return the TagRuleUpdatePropertiesInner object itself. + */ + public TagRuleUpdatePropertiesInner withMetricRules(MetricRulesInner metricRules) { + this.metricRules = metricRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logRules() != null) { + logRules().validate(); + } + if (metricRules() != null) { + metricRules().validate(); + } + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/VMExtensionPayloadInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/VMExtensionPayloadInner.java new file mode 100644 index 000000000000..e43a6ac85013 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/VMExtensionPayloadInner.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response of payload to be passed while installing VM agent. */ +@Fluent +public final class VMExtensionPayloadInner { + /* + * Ingestion key of the account + */ + @JsonProperty(value = "ingestionKey") + private String ingestionKey; + + /** Creates an instance of VMExtensionPayloadInner class. */ + public VMExtensionPayloadInner() { + } + + /** + * Get the ingestionKey property: Ingestion key of the account. + * + * @return the ingestionKey value. + */ + public String ingestionKey() { + return this.ingestionKey; + } + + /** + * Set the ingestionKey property: Ingestion key of the account. + * + * @param ingestionKey the ingestionKey value to set. + * @return the VMExtensionPayloadInner object itself. + */ + public VMExtensionPayloadInner withIngestionKey(String ingestionKey) { + this.ingestionKey = ingestionKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/VMInfoInner.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/VMInfoInner.java new file mode 100644 index 000000000000..800456201043 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/VMInfoInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of VM Resource having NewRelic OneAgent installed. */ +@Fluent +public final class VMInfoInner { + /* + * Azure VM resource ID + */ + @JsonProperty(value = "vmId") + private String vmId; + + /* + * Version of the NewRelic agent installed on the VM. + */ + @JsonProperty(value = "agentVersion") + private String agentVersion; + + /* + * Status of the NewRelic agent installed on the VM. + */ + @JsonProperty(value = "agentStatus") + private String agentStatus; + + /** Creates an instance of VMInfoInner class. */ + public VMInfoInner() { + } + + /** + * Get the vmId property: Azure VM resource ID. + * + * @return the vmId value. + */ + public String vmId() { + return this.vmId; + } + + /** + * Set the vmId property: Azure VM resource ID. + * + * @param vmId the vmId value to set. + * @return the VMInfoInner object itself. + */ + public VMInfoInner withVmId(String vmId) { + this.vmId = vmId; + return this; + } + + /** + * Get the agentVersion property: Version of the NewRelic agent installed on the VM. + * + * @return the agentVersion value. + */ + public String agentVersion() { + return this.agentVersion; + } + + /** + * Set the agentVersion property: Version of the NewRelic agent installed on the VM. + * + * @param agentVersion the agentVersion value to set. + * @return the VMInfoInner object itself. + */ + public VMInfoInner withAgentVersion(String agentVersion) { + this.agentVersion = agentVersion; + return this; + } + + /** + * Get the agentStatus property: Status of the NewRelic agent installed on the VM. + * + * @return the agentStatus value. + */ + public String agentStatus() { + return this.agentStatus; + } + + /** + * Set the agentStatus property: Status of the NewRelic agent installed on the VM. + * + * @param agentStatus the agentStatus value to set. + * @return the VMInfoInner object itself. + */ + public VMInfoInner withAgentStatus(String agentStatus) { + this.agentStatus = agentStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/package-info.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/models/package-info.java new file mode 100644 index 000000000000..4fa49947c0d5 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/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 NewRelicObservability. null. */ +package com.azure.resourcemanager.newrelic.fluent.models; diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/package-info.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/fluent/package-info.java new file mode 100644 index 000000000000..5af6b7519572 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/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 NewRelicObservability. null. */ +package com.azure.resourcemanager.newrelic.fluent; diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/AccountResourceImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/AccountResourceImpl.java new file mode 100644 index 000000000000..ac6a149d97de --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/AccountResourceImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelic.fluent.models.AccountResourceInner; +import com.azure.resourcemanager.newrelic.models.AccountResource; + +public final class AccountResourceImpl implements AccountResource { + private AccountResourceInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + AccountResourceImpl( + AccountResourceInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String organizationId() { + return this.innerModel().organizationId(); + } + + public String accountId() { + return this.innerModel().accountId(); + } + + public String accountName() { + return this.innerModel().accountName(); + } + + public String region() { + return this.innerModel().region(); + } + + public AccountResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/AccountsClientImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/AccountsClientImpl.java new file mode 100644 index 000000000000..8e3d12eade3b --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/AccountsClientImpl.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.newrelic.fluent.AccountsClient; +import com.azure.resourcemanager.newrelic.fluent.models.AccountResourceInner; +import com.azure.resourcemanager.newrelic.models.AccountsListResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AccountsClient. */ +public final class AccountsClientImpl implements AccountsClient { + /** The proxy service used to perform REST calls. */ + private final AccountsService service; + + /** The service client containing this operation class. */ + private final NewRelicObservabilityImpl client; + + /** + * Initializes an instance of AccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AccountsClientImpl(NewRelicObservabilityImpl client) { + this.service = RestProxy.create(AccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NewRelicObservabilityAccounts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "NewRelicObservabilit") + public interface AccountsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/NewRelic.Observability/accounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("userEmail") String userEmail, + @QueryParam("location") String location, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String userEmail, String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (userEmail == null) { + return Mono.error(new IllegalArgumentException("Parameter userEmail is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + userEmail, + location, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String userEmail, String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (userEmail == null) { + return Mono.error(new IllegalArgumentException("Parameter userEmail is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + userEmail, + location, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String userEmail, String location) { + return new PagedFlux<>( + () -> listSinglePageAsync(userEmail, location), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String userEmail, String location, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(userEmail, location, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String userEmail, String location) { + return new PagedIterable<>(listAsync(userEmail, location)); + } + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String userEmail, String location, Context context) { + return new PagedIterable<>(listAsync(userEmail, location, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/AccountsImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/AccountsImpl.java new file mode 100644 index 000000000000..f5b31fc40542 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/AccountsImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.fluent.AccountsClient; +import com.azure.resourcemanager.newrelic.fluent.models.AccountResourceInner; +import com.azure.resourcemanager.newrelic.models.AccountResource; +import com.azure.resourcemanager.newrelic.models.Accounts; + +public final class AccountsImpl implements Accounts { + private static final ClientLogger LOGGER = new ClientLogger(AccountsImpl.class); + + private final AccountsClient innerClient; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + public AccountsImpl(AccountsClient innerClient, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String userEmail, String location) { + PagedIterable inner = this.serviceClient().list(userEmail, location); + return Utils.mapPage(inner, inner1 -> new AccountResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String userEmail, String location, Context context) { + PagedIterable inner = this.serviceClient().list(userEmail, location, context); + return Utils.mapPage(inner, inner1 -> new AccountResourceImpl(inner1, this.manager())); + } + + private AccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/AppServiceInfoImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/AppServiceInfoImpl.java new file mode 100644 index 000000000000..560bea515a3e --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/AppServiceInfoImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.resourcemanager.newrelic.fluent.models.AppServiceInfoInner; +import com.azure.resourcemanager.newrelic.models.AppServiceInfo; + +public final class AppServiceInfoImpl implements AppServiceInfo { + private AppServiceInfoInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + AppServiceInfoImpl( + AppServiceInfoInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String azureResourceId() { + return this.innerModel().azureResourceId(); + } + + public String agentVersion() { + return this.innerModel().agentVersion(); + } + + public String agentStatus() { + return this.innerModel().agentStatus(); + } + + public AppServiceInfoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MetricRulesImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MetricRulesImpl.java new file mode 100644 index 000000000000..8592f3ba2a7b --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MetricRulesImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelic.models.FilteringTag; +import com.azure.resourcemanager.newrelic.models.MetricRules; +import com.azure.resourcemanager.newrelic.models.SendMetricsStatus; +import java.util.Collections; +import java.util.List; + +public final class MetricRulesImpl implements MetricRules { + private MetricRulesInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + MetricRulesImpl(MetricRulesInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public SendMetricsStatus sendMetrics() { + return this.innerModel().sendMetrics(); + } + + public List filteringTags() { + List inner = this.innerModel().filteringTags(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String userEmail() { + return this.innerModel().userEmail(); + } + + public MetricRulesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MetricsStatusResponseImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MetricsStatusResponseImpl.java new file mode 100644 index 000000000000..ce68c2e46990 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MetricsStatusResponseImpl.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.resourcemanager.newrelic.fluent.models.MetricsStatusResponseInner; +import com.azure.resourcemanager.newrelic.models.MetricsStatusResponse; +import java.util.Collections; +import java.util.List; + +public final class MetricsStatusResponseImpl implements MetricsStatusResponse { + private MetricsStatusResponseInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + MetricsStatusResponseImpl( + MetricsStatusResponseInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List azureResourceIds() { + List inner = this.innerModel().azureResourceIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MetricsStatusResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MonitoredResourceImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MonitoredResourceImpl.java new file mode 100644 index 000000000000..485ed23e56fc --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MonitoredResourceImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.resourcemanager.newrelic.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.newrelic.models.MonitoredResource; +import com.azure.resourcemanager.newrelic.models.SendingLogsStatus; +import com.azure.resourcemanager.newrelic.models.SendingMetricsStatus; + +public final class MonitoredResourceImpl implements MonitoredResource { + private MonitoredResourceInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + MonitoredResourceImpl( + MonitoredResourceInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public SendingMetricsStatus sendingMetrics() { + return this.innerModel().sendingMetrics(); + } + + public String reasonForMetricsStatus() { + return this.innerModel().reasonForMetricsStatus(); + } + + public SendingLogsStatus sendingLogs() { + return this.innerModel().sendingLogs(); + } + + public String reasonForLogsStatus() { + return this.innerModel().reasonForLogsStatus(); + } + + public MonitoredResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MonitoringTagRulesPropertiesImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MonitoringTagRulesPropertiesImpl.java new file mode 100644 index 000000000000..82744be91fbe --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MonitoringTagRulesPropertiesImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelic.fluent.models.MonitoringTagRulesPropertiesInner; +import com.azure.resourcemanager.newrelic.models.LogRules; +import com.azure.resourcemanager.newrelic.models.MetricRules; +import com.azure.resourcemanager.newrelic.models.MonitoringTagRulesProperties; +import com.azure.resourcemanager.newrelic.models.ProvisioningState; + +public final class MonitoringTagRulesPropertiesImpl implements MonitoringTagRulesProperties { + private MonitoringTagRulesPropertiesInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + MonitoringTagRulesPropertiesImpl( + MonitoringTagRulesPropertiesInner innerObject, + com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public LogRules logRules() { + return this.innerModel().logRules(); + } + + public MetricRules metricRules() { + MetricRulesInner inner = this.innerModel().metricRules(); + if (inner != null) { + return new MetricRulesImpl(inner, this.manager()); + } else { + return null; + } + } + + public MonitoringTagRulesPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MonitorsClientImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MonitorsClientImpl.java new file mode 100644 index 000000000000..34de6556afbd --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MonitorsClientImpl.java @@ -0,0 +1,3064 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.newrelic.fluent.MonitorsClient; +import com.azure.resourcemanager.newrelic.fluent.models.AppServiceInfoInner; +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelic.fluent.models.MetricsStatusResponseInner; +import com.azure.resourcemanager.newrelic.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.newrelic.fluent.models.NewRelicMonitorResourceInner; +import com.azure.resourcemanager.newrelic.fluent.models.VMExtensionPayloadInner; +import com.azure.resourcemanager.newrelic.fluent.models.VMInfoInner; +import com.azure.resourcemanager.newrelic.models.AppServicesGetRequest; +import com.azure.resourcemanager.newrelic.models.AppServicesListResponse; +import com.azure.resourcemanager.newrelic.models.HostsGetRequest; +import com.azure.resourcemanager.newrelic.models.MetricsRequest; +import com.azure.resourcemanager.newrelic.models.MetricsStatusRequest; +import com.azure.resourcemanager.newrelic.models.MonitoredResourceListResponse; +import com.azure.resourcemanager.newrelic.models.NewRelicMonitorResourceListResult; +import com.azure.resourcemanager.newrelic.models.NewRelicMonitorResourceUpdate; +import com.azure.resourcemanager.newrelic.models.SwitchBillingRequest; +import com.azure.resourcemanager.newrelic.models.VMHostsListResponse; +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 MonitorsClient. */ +public final class MonitorsClientImpl implements MonitorsClient { + /** The proxy service used to perform REST calls. */ + private final MonitorsService service; + + /** The service client containing this operation class. */ + private final NewRelicObservabilityImpl client; + + /** + * Initializes an instance of MonitorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MonitorsClientImpl(NewRelicObservabilityImpl client) { + this.service = RestProxy.create(MonitorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NewRelicObservabilityMonitors to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "NewRelicObservabilit") + public interface MonitorsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/NewRelic.Observability/monitors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") NewRelicMonitorResourceInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") NewRelicMonitorResourceUpdate properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("userEmail") String userEmail, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}/getMetricRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMetricRules( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") MetricsRequest request, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}/getMetricStatus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMetricStatus( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") MetricsStatusRequest request, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}/listAppServices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAppServices( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") AppServicesGetRequest request, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}/switchBilling") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> switchBilling( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") SwitchBillingRequest request, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}/listHosts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listHosts( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") HostsGetRequest request, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}/monitoredResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMonitoredResources( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}/vmHostPayloads") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> vmHostPayload( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAppServicesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listHostsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMonitoredResourcesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context); + } + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String monitorName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, monitorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, monitorName, context).block(); + } + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NewRelicMonitorResourceInner getByResourceGroup(String resourceGroupName, String monitorName) { + return getByResourceGroupWithResponse(resourceGroupName, monitorName, Context.NONE).getValue(); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + resource, + accept, + context); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NewRelicMonitorResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, monitorName, resource); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + NewRelicMonitorResourceInner.class, + NewRelicMonitorResourceInner.class, + this.client.getContext()); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NewRelicMonitorResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, monitorName, resource, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + NewRelicMonitorResourceInner.class, + NewRelicMonitorResourceInner.class, + context); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NewRelicMonitorResourceInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, monitorName, resource).getSyncPoller(); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NewRelicMonitorResourceInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, monitorName, resource, context).getSyncPoller(); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NewRelicMonitorResourceInner createOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource) { + return createOrUpdateAsync(resourceGroupName, monitorName, resource).block(); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NewRelicMonitorResourceInner createOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, monitorName, resource, context).block(); + } + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + properties, + accept, + context); + } + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties) { + return updateWithResponseAsync(resourceGroupName, monitorName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties, Context context) { + return updateWithResponseAsync(resourceGroupName, monitorName, properties, context).block(); + } + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NewRelicMonitorResourceInner update( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties) { + return updateWithResponse(resourceGroupName, monitorName, properties, Context.NONE).getValue(); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String userEmail, String monitorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (userEmail == null) { + return Mono.error(new IllegalArgumentException("Parameter userEmail is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + userEmail, + monitorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String userEmail, String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (userEmail == null) { + return Mono.error(new IllegalArgumentException("Parameter userEmail is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + userEmail, + monitorName, + accept, + context); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String userEmail, String monitorName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, userEmail, monitorName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String userEmail, String monitorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, userEmail, monitorName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String userEmail, String monitorName) { + return this.beginDeleteAsync(resourceGroupName, userEmail, monitorName).getSyncPoller(); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String userEmail, String monitorName, Context context) { + return this.beginDeleteAsync(resourceGroupName, userEmail, monitorName, context).getSyncPoller(); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String userEmail, String monitorName) { + return beginDeleteAsync(resourceGroupName, userEmail, monitorName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String userEmail, String monitorName, Context context) { + return beginDeleteAsync(resourceGroupName, userEmail, monitorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String userEmail, String monitorName) { + deleteAsync(resourceGroupName, userEmail, monitorName).block(); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String userEmail, String monitorName, Context context) { + deleteAsync(resourceGroupName, userEmail, monitorName, context).block(); + } + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric rules along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMetricRulesWithResponseAsync( + String resourceGroupName, String monitorName, MetricsRequest request) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMetricRules( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric rules along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMetricRulesWithResponseAsync( + String resourceGroupName, String monitorName, MetricsRequest request, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMetricRules( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context); + } + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric rules on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMetricRulesAsync( + String resourceGroupName, String monitorName, MetricsRequest request) { + return getMetricRulesWithResponseAsync(resourceGroupName, monitorName, request) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric rules along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMetricRulesWithResponse( + String resourceGroupName, String monitorName, MetricsRequest request, Context context) { + return getMetricRulesWithResponseAsync(resourceGroupName, monitorName, request, context).block(); + } + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetricRulesInner getMetricRules(String resourceGroupName, String monitorName, MetricsRequest request) { + return getMetricRulesWithResponse(resourceGroupName, monitorName, request, Context.NONE).getValue(); + } + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric status along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMetricStatusWithResponseAsync( + String resourceGroupName, String monitorName, MetricsStatusRequest request) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMetricStatus( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric status along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMetricStatusWithResponseAsync( + String resourceGroupName, String monitorName, MetricsStatusRequest request, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMetricStatus( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context); + } + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric status on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMetricStatusAsync( + String resourceGroupName, String monitorName, MetricsStatusRequest request) { + return getMetricStatusWithResponseAsync(resourceGroupName, monitorName, request) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMetricStatusWithResponse( + String resourceGroupName, String monitorName, MetricsStatusRequest request, Context context) { + return getMetricStatusWithResponseAsync(resourceGroupName, monitorName, request, context).block(); + } + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetricsStatusResponseInner getMetricStatus( + String resourceGroupName, String monitorName, MetricsStatusRequest request) { + return getMetricStatusWithResponse(resourceGroupName, monitorName, request, Context.NONE).getValue(); + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get 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 response of a list app services Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAppServicesSinglePageAsync( + String resourceGroupName, String monitorName, AppServicesGetRequest request) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAppServices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get 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 response of a list app services Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAppServicesSinglePageAsync( + String resourceGroupName, String monitorName, AppServicesGetRequest request, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAppServices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get 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 response of a list app services Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAppServicesAsync( + String resourceGroupName, String monitorName, AppServicesGetRequest request) { + return new PagedFlux<>( + () -> listAppServicesSinglePageAsync(resourceGroupName, monitorName, request), + nextLink -> listAppServicesNextSinglePageAsync(nextLink)); + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get 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 response of a list app services Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAppServicesAsync( + String resourceGroupName, String monitorName, AppServicesGetRequest request, Context context) { + return new PagedFlux<>( + () -> listAppServicesSinglePageAsync(resourceGroupName, monitorName, request, context), + nextLink -> listAppServicesNextSinglePageAsync(nextLink, context)); + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get 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 response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request) { + return new PagedIterable<>(listAppServicesAsync(resourceGroupName, monitorName, request)); + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get 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 response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request, Context context) { + return new PagedIterable<>(listAppServicesAsync(resourceGroupName, monitorName, request, context)); + } + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing 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> switchBillingWithResponseAsync( + String resourceGroupName, String monitorName, SwitchBillingRequest request) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .switchBilling( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing 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> switchBillingWithResponseAsync( + String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .switchBilling( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context); + } + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing 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 switchBillingAsync(String resourceGroupName, String monitorName, SwitchBillingRequest request) { + return switchBillingWithResponseAsync(resourceGroupName, monitorName, request).flatMap(ignored -> Mono.empty()); + } + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing 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 switchBillingWithResponse( + String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context) { + return switchBillingWithResponseAsync(resourceGroupName, monitorName, request, context).block(); + } + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing 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 switchBilling(String resourceGroupName, String monitorName, SwitchBillingRequest request) { + switchBillingWithResponse(resourceGroupName, monitorName, request, Context.NONE); + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get 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 response of a list VM Host Operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHostsSinglePageAsync( + String resourceGroupName, String monitorName, HostsGetRequest request) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listHosts( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get 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 response of a list VM Host Operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHostsSinglePageAsync( + String resourceGroupName, String monitorName, HostsGetRequest request, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listHosts( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get 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 response of a list VM Host Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listHostsAsync( + String resourceGroupName, String monitorName, HostsGetRequest request) { + return new PagedFlux<>( + () -> listHostsSinglePageAsync(resourceGroupName, monitorName, request), + nextLink -> listHostsNextSinglePageAsync(nextLink)); + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get 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 response of a list VM Host Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listHostsAsync( + String resourceGroupName, String monitorName, HostsGetRequest request, Context context) { + return new PagedFlux<>( + () -> listHostsSinglePageAsync(resourceGroupName, monitorName, request, context), + nextLink -> listHostsNextSinglePageAsync(nextLink, context)); + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get 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 response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listHosts(String resourceGroupName, String monitorName, HostsGetRequest request) { + return new PagedIterable<>(listHostsAsync(resourceGroupName, monitorName, request)); + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get 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 response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listHosts( + String resourceGroupName, String monitorName, HostsGetRequest request, Context context) { + return new PagedIterable<>(listHostsAsync(resourceGroupName, monitorName, request, context)); + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesSinglePageAsync( + String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMonitoredResources( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesSinglePageAsync( + String resourceGroupName, String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMonitoredResources( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMonitoredResourcesAsync( + String resourceGroupName, String monitorName) { + return new PagedFlux<>( + () -> listMonitoredResourcesSinglePageAsync(resourceGroupName, monitorName), + nextLink -> listMonitoredResourcesNextSinglePageAsync(nextLink)); + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMonitoredResourcesAsync( + String resourceGroupName, String monitorName, Context context) { + return new PagedFlux<>( + () -> listMonitoredResourcesSinglePageAsync(resourceGroupName, monitorName, context), + nextLink -> listMonitoredResourcesNextSinglePageAsync(nextLink, context)); + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMonitoredResources(String resourceGroupName, String monitorName) { + return new PagedIterable<>(listMonitoredResourcesAsync(resourceGroupName, monitorName)); + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, Context context) { + return new PagedIterable<>(listMonitoredResourcesAsync(resourceGroupName, monitorName, context)); + } + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of payload to be passed while installing VM agent along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> vmHostPayloadWithResponseAsync( + String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .vmHostPayload( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of payload to be passed while installing VM agent along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> vmHostPayloadWithResponseAsync( + String resourceGroupName, String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .vmHostPayload( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context); + } + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of payload to be passed while installing VM agent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono vmHostPayloadAsync(String resourceGroupName, String monitorName) { + return vmHostPayloadWithResponseAsync(resourceGroupName, monitorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of payload to be passed while installing VM agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response vmHostPayloadWithResponse( + String resourceGroupName, String monitorName, Context context) { + return vmHostPayloadWithResponseAsync(resourceGroupName, monitorName, context).block(); + } + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of payload to be passed while installing VM agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VMExtensionPayloadInner vmHostPayload(String resourceGroupName, String monitorName) { + return vmHostPayloadWithResponse(resourceGroupName, monitorName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAppServicesNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAppServicesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAppServicesNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAppServicesNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHostsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listHostsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHostsNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listHostsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listMonitoredResourcesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMonitoredResourcesNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MonitorsImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MonitorsImpl.java new file mode 100644 index 000000000000..a52555879d4b --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/MonitorsImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.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.newrelic.fluent.MonitorsClient; +import com.azure.resourcemanager.newrelic.fluent.models.AppServiceInfoInner; +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelic.fluent.models.MetricsStatusResponseInner; +import com.azure.resourcemanager.newrelic.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.newrelic.fluent.models.NewRelicMonitorResourceInner; +import com.azure.resourcemanager.newrelic.fluent.models.VMExtensionPayloadInner; +import com.azure.resourcemanager.newrelic.fluent.models.VMInfoInner; +import com.azure.resourcemanager.newrelic.models.AppServiceInfo; +import com.azure.resourcemanager.newrelic.models.AppServicesGetRequest; +import com.azure.resourcemanager.newrelic.models.HostsGetRequest; +import com.azure.resourcemanager.newrelic.models.MetricRules; +import com.azure.resourcemanager.newrelic.models.MetricsRequest; +import com.azure.resourcemanager.newrelic.models.MetricsStatusRequest; +import com.azure.resourcemanager.newrelic.models.MetricsStatusResponse; +import com.azure.resourcemanager.newrelic.models.MonitoredResource; +import com.azure.resourcemanager.newrelic.models.Monitors; +import com.azure.resourcemanager.newrelic.models.NewRelicMonitorResource; +import com.azure.resourcemanager.newrelic.models.SwitchBillingRequest; +import com.azure.resourcemanager.newrelic.models.VMExtensionPayload; +import com.azure.resourcemanager.newrelic.models.VMInfo; + +public final class MonitorsImpl implements Monitors { + private static final ClientLogger LOGGER = new ClientLogger(MonitorsImpl.class); + + private final MonitorsClient innerClient; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + public MonitorsImpl(MonitorsClient innerClient, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new NewRelicMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new NewRelicMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new NewRelicMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new NewRelicMonitorResourceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, monitorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NewRelicMonitorResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public NewRelicMonitorResource getByResourceGroup(String resourceGroupName, String monitorName) { + NewRelicMonitorResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, monitorName); + if (inner != null) { + return new NewRelicMonitorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String userEmail, String monitorName) { + this.serviceClient().delete(resourceGroupName, userEmail, monitorName); + } + + public void delete(String resourceGroupName, String userEmail, String monitorName, Context context) { + this.serviceClient().delete(resourceGroupName, userEmail, monitorName, context); + } + + public Response getMetricRulesWithResponse( + String resourceGroupName, String monitorName, MetricsRequest request, Context context) { + Response inner = + this.serviceClient().getMetricRulesWithResponse(resourceGroupName, monitorName, request, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MetricRulesImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MetricRules getMetricRules(String resourceGroupName, String monitorName, MetricsRequest request) { + MetricRulesInner inner = this.serviceClient().getMetricRules(resourceGroupName, monitorName, request); + if (inner != null) { + return new MetricRulesImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getMetricStatusWithResponse( + String resourceGroupName, String monitorName, MetricsStatusRequest request, Context context) { + Response inner = + this.serviceClient().getMetricStatusWithResponse(resourceGroupName, monitorName, request, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MetricsStatusResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MetricsStatusResponse getMetricStatus( + String resourceGroupName, String monitorName, MetricsStatusRequest request) { + MetricsStatusResponseInner inner = + this.serviceClient().getMetricStatus(resourceGroupName, monitorName, request); + if (inner != null) { + return new MetricsStatusResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request) { + PagedIterable inner = + this.serviceClient().listAppServices(resourceGroupName, monitorName, request); + return Utils.mapPage(inner, inner1 -> new AppServiceInfoImpl(inner1, this.manager())); + } + + public PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request, Context context) { + PagedIterable inner = + this.serviceClient().listAppServices(resourceGroupName, monitorName, request, context); + return Utils.mapPage(inner, inner1 -> new AppServiceInfoImpl(inner1, this.manager())); + } + + public Response switchBillingWithResponse( + String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context) { + return this.serviceClient().switchBillingWithResponse(resourceGroupName, monitorName, request, context); + } + + public void switchBilling(String resourceGroupName, String monitorName, SwitchBillingRequest request) { + this.serviceClient().switchBilling(resourceGroupName, monitorName, request); + } + + public PagedIterable listHosts(String resourceGroupName, String monitorName, HostsGetRequest request) { + PagedIterable inner = this.serviceClient().listHosts(resourceGroupName, monitorName, request); + return Utils.mapPage(inner, inner1 -> new VMInfoImpl(inner1, this.manager())); + } + + public PagedIterable listHosts( + String resourceGroupName, String monitorName, HostsGetRequest request, Context context) { + PagedIterable inner = + this.serviceClient().listHosts(resourceGroupName, monitorName, request, context); + return Utils.mapPage(inner, inner1 -> new VMInfoImpl(inner1, this.manager())); + } + + public PagedIterable listMonitoredResources(String resourceGroupName, String monitorName) { + PagedIterable inner = + this.serviceClient().listMonitoredResources(resourceGroupName, monitorName); + return Utils.mapPage(inner, inner1 -> new MonitoredResourceImpl(inner1, this.manager())); + } + + public PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = + this.serviceClient().listMonitoredResources(resourceGroupName, monitorName, context); + return Utils.mapPage(inner, inner1 -> new MonitoredResourceImpl(inner1, this.manager())); + } + + public Response vmHostPayloadWithResponse( + String resourceGroupName, String monitorName, Context context) { + Response inner = + this.serviceClient().vmHostPayloadWithResponse(resourceGroupName, monitorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VMExtensionPayloadImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VMExtensionPayload vmHostPayload(String resourceGroupName, String monitorName) { + VMExtensionPayloadInner inner = this.serviceClient().vmHostPayload(resourceGroupName, monitorName); + if (inner != null) { + return new VMExtensionPayloadImpl(inner, this.manager()); + } else { + return null; + } + } + + public NewRelicMonitorResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, monitorName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, monitorName, context); + } + + private MonitorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } + + public NewRelicMonitorResourceImpl define(String name) { + return new NewRelicMonitorResourceImpl(name, this.manager()); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/NewRelicMonitorResourceImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/NewRelicMonitorResourceImpl.java new file mode 100644 index 000000000000..6ed07166197f --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/NewRelicMonitorResourceImpl.java @@ -0,0 +1,370 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelic.fluent.models.NewRelicMonitorResourceInner; +import com.azure.resourcemanager.newrelic.models.AccountCreationSource; +import com.azure.resourcemanager.newrelic.models.AppServiceInfo; +import com.azure.resourcemanager.newrelic.models.AppServicesGetRequest; +import com.azure.resourcemanager.newrelic.models.HostsGetRequest; +import com.azure.resourcemanager.newrelic.models.LiftrResourceCategories; +import com.azure.resourcemanager.newrelic.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelic.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.newrelic.models.MetricRules; +import com.azure.resourcemanager.newrelic.models.MetricsRequest; +import com.azure.resourcemanager.newrelic.models.MetricsStatusRequest; +import com.azure.resourcemanager.newrelic.models.MetricsStatusResponse; +import com.azure.resourcemanager.newrelic.models.MonitoredResource; +import com.azure.resourcemanager.newrelic.models.MonitoringStatus; +import com.azure.resourcemanager.newrelic.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelic.models.NewRelicMonitorResource; +import com.azure.resourcemanager.newrelic.models.NewRelicMonitorResourceUpdate; +import com.azure.resourcemanager.newrelic.models.OrgCreationSource; +import com.azure.resourcemanager.newrelic.models.PlanData; +import com.azure.resourcemanager.newrelic.models.ProvisioningState; +import com.azure.resourcemanager.newrelic.models.SwitchBillingRequest; +import com.azure.resourcemanager.newrelic.models.UserInfo; +import com.azure.resourcemanager.newrelic.models.VMExtensionPayload; +import com.azure.resourcemanager.newrelic.models.VMInfo; +import java.util.Collections; +import java.util.Map; + +public final class NewRelicMonitorResourceImpl + implements NewRelicMonitorResource, NewRelicMonitorResource.Definition, NewRelicMonitorResource.Update { + private NewRelicMonitorResourceInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager 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 ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public MonitoringStatus monitoringStatus() { + return this.innerModel().monitoringStatus(); + } + + public MarketplaceSubscriptionStatus marketplaceSubscriptionStatus() { + return this.innerModel().marketplaceSubscriptionStatus(); + } + + public String marketplaceSubscriptionId() { + return this.innerModel().marketplaceSubscriptionId(); + } + + public NewRelicAccountProperties newRelicAccountProperties() { + return this.innerModel().newRelicAccountProperties(); + } + + public UserInfo userInfo() { + return this.innerModel().userInfo(); + } + + public PlanData planData() { + return this.innerModel().planData(); + } + + public LiftrResourceCategories liftrResourceCategory() { + return this.innerModel().liftrResourceCategory(); + } + + public Integer liftrResourcePreference() { + return this.innerModel().liftrResourcePreference(); + } + + public OrgCreationSource orgCreationSource() { + return this.innerModel().orgCreationSource(); + } + + public AccountCreationSource accountCreationSource() { + return this.innerModel().accountCreationSource(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public NewRelicMonitorResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String monitorName; + + private NewRelicMonitorResourceUpdate updateProperties; + + public NewRelicMonitorResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public NewRelicMonitorResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .createOrUpdate(resourceGroupName, monitorName, this.innerModel(), Context.NONE); + return this; + } + + public NewRelicMonitorResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .createOrUpdate(resourceGroupName, monitorName, this.innerModel(), context); + return this; + } + + NewRelicMonitorResourceImpl(String name, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = new NewRelicMonitorResourceInner(); + this.serviceManager = serviceManager; + this.monitorName = name; + } + + public NewRelicMonitorResourceImpl update() { + this.updateProperties = new NewRelicMonitorResourceUpdate(); + return this; + } + + public NewRelicMonitorResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .updateWithResponse(resourceGroupName, monitorName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public NewRelicMonitorResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .updateWithResponse(resourceGroupName, monitorName, updateProperties, context) + .getValue(); + return this; + } + + NewRelicMonitorResourceImpl( + NewRelicMonitorResourceInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.monitorName = Utils.getValueFromIdByName(innerObject.id(), "monitors"); + } + + public NewRelicMonitorResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .getByResourceGroupWithResponse(resourceGroupName, monitorName, Context.NONE) + .getValue(); + return this; + } + + public NewRelicMonitorResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .getByResourceGroupWithResponse(resourceGroupName, monitorName, context) + .getValue(); + return this; + } + + public Response getMetricRulesWithResponse(MetricsRequest request, Context context) { + return serviceManager.monitors().getMetricRulesWithResponse(resourceGroupName, monitorName, request, context); + } + + public MetricRules getMetricRules(MetricsRequest request) { + return serviceManager.monitors().getMetricRules(resourceGroupName, monitorName, request); + } + + public Response getMetricStatusWithResponse(MetricsStatusRequest request, Context context) { + return serviceManager.monitors().getMetricStatusWithResponse(resourceGroupName, monitorName, request, context); + } + + public MetricsStatusResponse getMetricStatus(MetricsStatusRequest request) { + return serviceManager.monitors().getMetricStatus(resourceGroupName, monitorName, request); + } + + public PagedIterable listAppServices(AppServicesGetRequest request) { + return serviceManager.monitors().listAppServices(resourceGroupName, monitorName, request); + } + + public PagedIterable listAppServices(AppServicesGetRequest request, Context context) { + return serviceManager.monitors().listAppServices(resourceGroupName, monitorName, request, context); + } + + public Response switchBillingWithResponse(SwitchBillingRequest request, Context context) { + return serviceManager.monitors().switchBillingWithResponse(resourceGroupName, monitorName, request, context); + } + + public void switchBilling(SwitchBillingRequest request) { + serviceManager.monitors().switchBilling(resourceGroupName, monitorName, request); + } + + public PagedIterable listHosts(HostsGetRequest request) { + return serviceManager.monitors().listHosts(resourceGroupName, monitorName, request); + } + + public PagedIterable listHosts(HostsGetRequest request, Context context) { + return serviceManager.monitors().listHosts(resourceGroupName, monitorName, request, context); + } + + public PagedIterable listMonitoredResources() { + return serviceManager.monitors().listMonitoredResources(resourceGroupName, monitorName); + } + + public PagedIterable listMonitoredResources(Context context) { + return serviceManager.monitors().listMonitoredResources(resourceGroupName, monitorName, context); + } + + public Response vmHostPayloadWithResponse(Context context) { + return serviceManager.monitors().vmHostPayloadWithResponse(resourceGroupName, monitorName, context); + } + + public VMExtensionPayload vmHostPayload() { + return serviceManager.monitors().vmHostPayload(resourceGroupName, monitorName); + } + + public NewRelicMonitorResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public NewRelicMonitorResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public NewRelicMonitorResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public NewRelicMonitorResourceImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + + public NewRelicMonitorResourceImpl withNewRelicAccountProperties( + NewRelicAccountProperties newRelicAccountProperties) { + if (isInCreateMode()) { + this.innerModel().withNewRelicAccountProperties(newRelicAccountProperties); + return this; + } else { + this.updateProperties.withNewRelicAccountProperties(newRelicAccountProperties); + return this; + } + } + + public NewRelicMonitorResourceImpl withUserInfo(UserInfo userInfo) { + if (isInCreateMode()) { + this.innerModel().withUserInfo(userInfo); + return this; + } else { + this.updateProperties.withUserInfo(userInfo); + return this; + } + } + + public NewRelicMonitorResourceImpl withPlanData(PlanData planData) { + if (isInCreateMode()) { + this.innerModel().withPlanData(planData); + return this; + } else { + this.updateProperties.withPlanData(planData); + return this; + } + } + + public NewRelicMonitorResourceImpl withOrgCreationSource(OrgCreationSource orgCreationSource) { + if (isInCreateMode()) { + this.innerModel().withOrgCreationSource(orgCreationSource); + return this; + } else { + this.updateProperties.withOrgCreationSource(orgCreationSource); + return this; + } + } + + public NewRelicMonitorResourceImpl withAccountCreationSource(AccountCreationSource accountCreationSource) { + if (isInCreateMode()) { + this.innerModel().withAccountCreationSource(accountCreationSource); + return this; + } else { + this.updateProperties.withAccountCreationSource(accountCreationSource); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/NewRelicObservabilityBuilder.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/NewRelicObservabilityBuilder.java new file mode 100644 index 000000000000..8fa21fb73309 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/NewRelicObservabilityBuilder.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.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 NewRelicObservabilityImpl type. */ +@ServiceClientBuilder(serviceClients = {NewRelicObservabilityImpl.class}) +public final class NewRelicObservabilityBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the NewRelicObservabilityBuilder. + */ + public NewRelicObservabilityBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the NewRelicObservabilityBuilder. + */ + public NewRelicObservabilityBuilder 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 NewRelicObservabilityBuilder. + */ + public NewRelicObservabilityBuilder 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 NewRelicObservabilityBuilder. + */ + public NewRelicObservabilityBuilder 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 NewRelicObservabilityBuilder. + */ + public NewRelicObservabilityBuilder 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 NewRelicObservabilityBuilder. + */ + public NewRelicObservabilityBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of NewRelicObservabilityImpl with the provided parameters. + * + * @return an instance of NewRelicObservabilityImpl. + */ + public NewRelicObservabilityImpl 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(); + NewRelicObservabilityImpl client = + new NewRelicObservabilityImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/NewRelicObservabilityImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/NewRelicObservabilityImpl.java new file mode 100644 index 000000000000..d9bed053c17a --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/NewRelicObservabilityImpl.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.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.newrelic.fluent.AccountsClient; +import com.azure.resourcemanager.newrelic.fluent.MonitorsClient; +import com.azure.resourcemanager.newrelic.fluent.NewRelicObservability; +import com.azure.resourcemanager.newrelic.fluent.OperationsClient; +import com.azure.resourcemanager.newrelic.fluent.OrganizationsClient; +import com.azure.resourcemanager.newrelic.fluent.PlansClient; +import com.azure.resourcemanager.newrelic.fluent.TagRulesClient; +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 NewRelicObservabilityImpl type. */ +@ServiceClient(builder = NewRelicObservabilityBuilder.class) +public final class NewRelicObservabilityImpl implements NewRelicObservability { + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** 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 OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The AccountsClient object to access its operations. */ + private final AccountsClient accounts; + + /** + * Gets the AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + public AccountsClient getAccounts() { + return this.accounts; + } + + /** The MonitorsClient object to access its operations. */ + private final MonitorsClient monitors; + + /** + * Gets the MonitorsClient object to access its operations. + * + * @return the MonitorsClient object. + */ + public MonitorsClient getMonitors() { + return this.monitors; + } + + /** The OrganizationsClient object to access its operations. */ + private final OrganizationsClient organizations; + + /** + * Gets the OrganizationsClient object to access its operations. + * + * @return the OrganizationsClient object. + */ + public OrganizationsClient getOrganizations() { + return this.organizations; + } + + /** The PlansClient object to access its operations. */ + private final PlansClient plans; + + /** + * Gets the PlansClient object to access its operations. + * + * @return the PlansClient object. + */ + public PlansClient getPlans() { + return this.plans; + } + + /** The TagRulesClient object to access its operations. */ + private final TagRulesClient tagRules; + + /** + * Gets the TagRulesClient object to access its operations. + * + * @return the TagRulesClient object. + */ + public TagRulesClient getTagRules() { + return this.tagRules; + } + + /** + * Initializes an instance of NewRelicObservability 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 subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + NewRelicObservabilityImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2022-07-01-preview"; + this.operations = new OperationsClientImpl(this); + this.accounts = new AccountsClientImpl(this); + this.monitors = new MonitorsClientImpl(this); + this.organizations = new OrganizationsClientImpl(this); + this.plans = new PlansClientImpl(this); + this.tagRules = new TagRulesClientImpl(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(NewRelicObservabilityImpl.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OperationImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OperationImpl.java new file mode 100644 index 000000000000..fab09341f656 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.resourcemanager.newrelic.fluent.models.OperationInner; +import com.azure.resourcemanager.newrelic.models.ActionType; +import com.azure.resourcemanager.newrelic.models.Operation; +import com.azure.resourcemanager.newrelic.models.OperationDisplay; +import com.azure.resourcemanager.newrelic.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OperationsClientImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..ddaadb195c20 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OperationsClientImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.newrelic.fluent.OperationsClient; +import com.azure.resourcemanager.newrelic.fluent.models.OperationInner; +import com.azure.resourcemanager.newrelic.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final NewRelicObservabilityImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(NewRelicObservabilityImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NewRelicObservabilityOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "NewRelicObservabilit") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/NewRelic.Observability/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OperationsImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b45e95b08292 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.fluent.OperationsClient; +import com.azure.resourcemanager.newrelic.fluent.models.OperationInner; +import com.azure.resourcemanager.newrelic.models.Operation; +import com.azure.resourcemanager.newrelic.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OrganizationResourceImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OrganizationResourceImpl.java new file mode 100644 index 000000000000..a9546f4651f6 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OrganizationResourceImpl.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.newrelic.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelic.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.newrelic.models.BillingSource; +import com.azure.resourcemanager.newrelic.models.OrganizationResource; + +public final class OrganizationResourceImpl implements OrganizationResource { + private OrganizationResourceInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + OrganizationResourceImpl( + OrganizationResourceInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String organizationId() { + return this.innerModel().organizationId(); + } + + public String organizationName() { + return this.innerModel().organizationName(); + } + + public BillingSource billingSource() { + return this.innerModel().billingSource(); + } + + public OrganizationResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OrganizationsClientImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OrganizationsClientImpl.java new file mode 100644 index 000000000000..3babac49f213 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OrganizationsClientImpl.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.newrelic.fluent.OrganizationsClient; +import com.azure.resourcemanager.newrelic.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.newrelic.models.OrganizationsListResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OrganizationsClient. */ +public final class OrganizationsClientImpl implements OrganizationsClient { + /** The proxy service used to perform REST calls. */ + private final OrganizationsService service; + + /** The service client containing this operation class. */ + private final NewRelicObservabilityImpl client; + + /** + * Initializes an instance of OrganizationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OrganizationsClientImpl(NewRelicObservabilityImpl client) { + this.service = + RestProxy.create(OrganizationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NewRelicObservabilityOrganizations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "NewRelicObservabilit") + public interface OrganizationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/NewRelic.Observability/organizations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("userEmail") String userEmail, + @QueryParam("location") String location, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String userEmail, String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (userEmail == null) { + return Mono.error(new IllegalArgumentException("Parameter userEmail is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + userEmail, + location, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String userEmail, String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (userEmail == null) { + return Mono.error(new IllegalArgumentException("Parameter userEmail is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + userEmail, + location, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String userEmail, String location) { + return new PagedFlux<>( + () -> listSinglePageAsync(userEmail, location), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String userEmail, String location, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(userEmail, location, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String userEmail, String location) { + return new PagedIterable<>(listAsync(userEmail, location)); + } + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String userEmail, String location, Context context) { + return new PagedIterable<>(listAsync(userEmail, location, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OrganizationsImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OrganizationsImpl.java new file mode 100644 index 000000000000..0690079913c1 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/OrganizationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.fluent.OrganizationsClient; +import com.azure.resourcemanager.newrelic.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.newrelic.models.OrganizationResource; +import com.azure.resourcemanager.newrelic.models.Organizations; + +public final class OrganizationsImpl implements Organizations { + private static final ClientLogger LOGGER = new ClientLogger(OrganizationsImpl.class); + + private final OrganizationsClient innerClient; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + public OrganizationsImpl( + OrganizationsClient innerClient, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String userEmail, String location) { + PagedIterable inner = this.serviceClient().list(userEmail, location); + return Utils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String userEmail, String location, Context context) { + PagedIterable inner = this.serviceClient().list(userEmail, location, context); + return Utils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager())); + } + + private OrganizationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/PlanDataResourceImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/PlanDataResourceImpl.java new file mode 100644 index 000000000000..c934910b4cd0 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/PlanDataResourceImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelic.fluent.models.PlanDataResourceInner; +import com.azure.resourcemanager.newrelic.models.AccountCreationSource; +import com.azure.resourcemanager.newrelic.models.OrgCreationSource; +import com.azure.resourcemanager.newrelic.models.PlanData; +import com.azure.resourcemanager.newrelic.models.PlanDataResource; + +public final class PlanDataResourceImpl implements PlanDataResource { + private PlanDataResourceInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + PlanDataResourceImpl( + PlanDataResourceInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public PlanData planData() { + return this.innerModel().planData(); + } + + public OrgCreationSource orgCreationSource() { + return this.innerModel().orgCreationSource(); + } + + public AccountCreationSource accountCreationSource() { + return this.innerModel().accountCreationSource(); + } + + public PlanDataResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/PlansClientImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/PlansClientImpl.java new file mode 100644 index 000000000000..cf6780c6f264 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/PlansClientImpl.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.newrelic.fluent.PlansClient; +import com.azure.resourcemanager.newrelic.fluent.models.PlanDataResourceInner; +import com.azure.resourcemanager.newrelic.models.PlanDataListResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PlansClient. */ +public final class PlansClientImpl implements PlansClient { + /** The proxy service used to perform REST calls. */ + private final PlansService service; + + /** The service client containing this operation class. */ + private final NewRelicObservabilityImpl client; + + /** + * Initializes an instance of PlansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PlansClientImpl(NewRelicObservabilityImpl client) { + this.service = RestProxy.create(PlansService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NewRelicObservabilityPlans to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "NewRelicObservabilit") + public interface PlansService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/NewRelic.Observability/plans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("accountId") String accountId, + @QueryParam("organizationId") String organizationId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization 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 response of get all plan data Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String accountId, String organizationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accountId, + organizationId, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization 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 response of get all plan data Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String accountId, String organizationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accountId, + organizationId, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization 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 response of get all plan data Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String accountId, String organizationId) { + return new PagedFlux<>( + () -> listSinglePageAsync(accountId, organizationId), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List plans data. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String accountId = null; + final String organizationId = null; + return new PagedFlux<>( + () -> listSinglePageAsync(accountId, organizationId), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization 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 response of get all plan data Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String accountId, String organizationId, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(accountId, organizationId, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List plans data. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String accountId = null; + final String organizationId = null; + return new PagedIterable<>(listAsync(accountId, organizationId)); + } + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization 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 response of get all plan data Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String accountId, String organizationId, Context context) { + return new PagedIterable<>(listAsync(accountId, organizationId, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/PlansImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/PlansImpl.java new file mode 100644 index 000000000000..fd8e5f59cae4 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/PlansImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.fluent.PlansClient; +import com.azure.resourcemanager.newrelic.fluent.models.PlanDataResourceInner; +import com.azure.resourcemanager.newrelic.models.PlanDataResource; +import com.azure.resourcemanager.newrelic.models.Plans; + +public final class PlansImpl implements Plans { + private static final ClientLogger LOGGER = new ClientLogger(PlansImpl.class); + + private final PlansClient innerClient; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + public PlansImpl(PlansClient innerClient, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new PlanDataResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String accountId, String organizationId, Context context) { + PagedIterable inner = this.serviceClient().list(accountId, organizationId, context); + return Utils.mapPage(inner, inner1 -> new PlanDataResourceImpl(inner1, this.manager())); + } + + private PlansClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRuleImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRuleImpl.java new file mode 100644 index 000000000000..2e6eb2fce08f --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRuleImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelic.fluent.models.TagRuleInner; +import com.azure.resourcemanager.newrelic.fluent.models.TagRuleUpdateInner; +import com.azure.resourcemanager.newrelic.models.LogRules; +import com.azure.resourcemanager.newrelic.models.MetricRules; +import com.azure.resourcemanager.newrelic.models.ProvisioningState; +import com.azure.resourcemanager.newrelic.models.TagRule; + +public final class TagRuleImpl implements TagRule, TagRule.Definition, TagRule.Update { + private TagRuleInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public LogRules logRules() { + return this.innerModel().logRules(); + } + + public MetricRules metricRules() { + MetricRulesInner inner = this.innerModel().metricRules(); + if (inner != null) { + return new MetricRulesImpl(inner, this.manager()); + } else { + return null; + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public TagRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String monitorName; + + private String ruleSetName; + + private TagRuleUpdateInner updateProperties; + + public TagRuleImpl withExistingMonitor(String resourceGroupName, String monitorName) { + this.resourceGroupName = resourceGroupName; + this.monitorName = monitorName; + return this; + } + + public TagRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .createOrUpdate(resourceGroupName, monitorName, ruleSetName, this.innerModel(), Context.NONE); + return this; + } + + public TagRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .createOrUpdate(resourceGroupName, monitorName, ruleSetName, this.innerModel(), context); + return this; + } + + TagRuleImpl(String name, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = new TagRuleInner(); + this.serviceManager = serviceManager; + this.ruleSetName = name; + } + + public TagRuleImpl update() { + this.updateProperties = new TagRuleUpdateInner(); + return this; + } + + public TagRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .updateWithResponse(resourceGroupName, monitorName, ruleSetName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public TagRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .updateWithResponse(resourceGroupName, monitorName, ruleSetName, updateProperties, context) + .getValue(); + return this; + } + + TagRuleImpl(TagRuleInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.monitorName = Utils.getValueFromIdByName(innerObject.id(), "monitors"); + this.ruleSetName = Utils.getValueFromIdByName(innerObject.id(), "tagRules"); + } + + public TagRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .getWithResponse(resourceGroupName, monitorName, ruleSetName, Context.NONE) + .getValue(); + return this; + } + + public TagRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .getWithResponse(resourceGroupName, monitorName, ruleSetName, context) + .getValue(); + return this; + } + + public TagRuleImpl withLogRules(LogRules logRules) { + if (isInCreateMode()) { + this.innerModel().withLogRules(logRules); + return this; + } else { + this.updateProperties.withLogRules(logRules); + return this; + } + } + + public TagRuleImpl withMetricRules(MetricRulesInner metricRules) { + if (isInCreateMode()) { + this.innerModel().withMetricRules(metricRules); + return this; + } else { + this.updateProperties.withMetricRules(metricRules); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRuleUpdateImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRuleUpdateImpl.java new file mode 100644 index 000000000000..927d3fb3542d --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRuleUpdateImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelic.fluent.models.TagRuleUpdateInner; +import com.azure.resourcemanager.newrelic.models.LogRules; +import com.azure.resourcemanager.newrelic.models.MetricRules; +import com.azure.resourcemanager.newrelic.models.TagRuleUpdate; + +public final class TagRuleUpdateImpl implements TagRuleUpdate { + private TagRuleUpdateInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + TagRuleUpdateImpl( + TagRuleUpdateInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public LogRules logRules() { + return this.innerModel().logRules(); + } + + public MetricRules metricRules() { + MetricRulesInner inner = this.innerModel().metricRules(); + if (inner != null) { + return new MetricRulesImpl(inner, this.manager()); + } else { + return null; + } + } + + public TagRuleUpdateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRuleUpdatePropertiesImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRuleUpdatePropertiesImpl.java new file mode 100644 index 000000000000..f66f4f73a47c --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRuleUpdatePropertiesImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelic.fluent.models.TagRuleUpdatePropertiesInner; +import com.azure.resourcemanager.newrelic.models.LogRules; +import com.azure.resourcemanager.newrelic.models.MetricRules; +import com.azure.resourcemanager.newrelic.models.TagRuleUpdateProperties; + +public final class TagRuleUpdatePropertiesImpl implements TagRuleUpdateProperties { + private TagRuleUpdatePropertiesInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + TagRuleUpdatePropertiesImpl( + TagRuleUpdatePropertiesInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public LogRules logRules() { + return this.innerModel().logRules(); + } + + public MetricRules metricRules() { + MetricRulesInner inner = this.innerModel().metricRules(); + if (inner != null) { + return new MetricRulesImpl(inner, this.manager()); + } else { + return null; + } + } + + public TagRuleUpdatePropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRulesClientImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRulesClientImpl.java new file mode 100644 index 000000000000..bc5672b08587 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRulesClientImpl.java @@ -0,0 +1,1294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.newrelic.fluent.TagRulesClient; +import com.azure.resourcemanager.newrelic.fluent.models.TagRuleInner; +import com.azure.resourcemanager.newrelic.fluent.models.TagRuleUpdateInner; +import com.azure.resourcemanager.newrelic.models.TagRuleListResult; +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 TagRulesClient. */ +public final class TagRulesClientImpl implements TagRulesClient { + /** The proxy service used to perform REST calls. */ + private final TagRulesService service; + + /** The service client containing this operation class. */ + private final NewRelicObservabilityImpl client; + + /** + * Initializes an instance of TagRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TagRulesClientImpl(NewRelicObservabilityImpl client) { + this.service = RestProxy.create(TagRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NewRelicObservabilityTagRules to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "NewRelicObservabilit") + public interface TagRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}/tagRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByNewRelicMonitorResource( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @BodyParam("application/json") TagRuleInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability" + + "/monitors/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @BodyParam("application/json") TagRuleUpdateInner properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByNewRelicMonitorResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByNewRelicMonitorResourceSinglePageAsync( + String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByNewRelicMonitorResource( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByNewRelicMonitorResourceSinglePageAsync( + String resourceGroupName, String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByNewRelicMonitorResource( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByNewRelicMonitorResourceAsync(String resourceGroupName, String monitorName) { + return new PagedFlux<>( + () -> listByNewRelicMonitorResourceSinglePageAsync(resourceGroupName, monitorName), + nextLink -> listByNewRelicMonitorResourceNextSinglePageAsync(nextLink)); + } + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByNewRelicMonitorResourceAsync( + String resourceGroupName, String monitorName, Context context) { + return new PagedFlux<>( + () -> listByNewRelicMonitorResourceSinglePageAsync(resourceGroupName, monitorName, context), + nextLink -> listByNewRelicMonitorResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByNewRelicMonitorResource(String resourceGroupName, String monitorName) { + return new PagedIterable<>(listByNewRelicMonitorResourceAsync(resourceGroupName, monitorName)); + } + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByNewRelicMonitorResource( + String resourceGroupName, String monitorName, Context context) { + return new PagedIterable<>(listByNewRelicMonitorResourceAsync(resourceGroupName, monitorName, context)); + } + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + accept, + context); + } + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String monitorName, String ruleSetName) { + return getWithResponseAsync(resourceGroupName, monitorName, ruleSetName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + return getWithResponseAsync(resourceGroupName, monitorName, ruleSetName, context).block(); + } + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagRuleInner get(String resourceGroupName, String monitorName, String ruleSetName) { + return getWithResponse(resourceGroupName, monitorName, ruleSetName, Context.NONE).getValue(); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + resource, + accept, + context); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TagRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, resource); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), TagRuleInner.class, TagRuleInner.class, this.client.getContext()); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TagRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, resource, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), TagRuleInner.class, TagRuleInner.class, context); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TagRuleInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, monitorName, ruleSetName, resource).getSyncPoller(); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TagRuleInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, monitorName, ruleSetName, resource, context) + .getSyncPoller(); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, ruleSetName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, ruleSetName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagRuleInner createOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource) { + return createOrUpdateAsync(resourceGroupName, monitorName, ruleSetName, resource).block(); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagRuleInner createOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, monitorName, ruleSetName, resource, context).block(); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + accept, + context); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String monitorName, String ruleSetName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, monitorName, ruleSetName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, monitorName, ruleSetName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String monitorName, String ruleSetName) { + return this.beginDeleteAsync(resourceGroupName, monitorName, ruleSetName).getSyncPoller(); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + return this.beginDeleteAsync(resourceGroupName, monitorName, ruleSetName, context).getSyncPoller(); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String monitorName, String ruleSetName) { + return beginDeleteAsync(resourceGroupName, monitorName, ruleSetName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String monitorName, String ruleSetName, Context context) { + return beginDeleteAsync(resourceGroupName, monitorName, ruleSetName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String monitorName, String ruleSetName) { + deleteAsync(resourceGroupName, monitorName, ruleSetName).block(); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String monitorName, String ruleSetName, Context context) { + deleteAsync(resourceGroupName, monitorName, ruleSetName, context).block(); + } + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleUpdateInner properties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String monitorName, + String ruleSetName, + TagRuleUpdateInner properties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + properties, + accept, + context); + } + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleUpdateInner properties) { + return updateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String monitorName, + String ruleSetName, + TagRuleUpdateInner properties, + Context context) { + return updateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, properties, context).block(); + } + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagRuleInner update( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleUpdateInner properties) { + return updateWithResponse(resourceGroupName, monitorName, ruleSetName, properties, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByNewRelicMonitorResourceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listByNewRelicMonitorResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByNewRelicMonitorResourceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByNewRelicMonitorResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRulesImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRulesImpl.java new file mode 100644 index 000000000000..67de3c4d63b8 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/TagRulesImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.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.newrelic.fluent.TagRulesClient; +import com.azure.resourcemanager.newrelic.fluent.models.TagRuleInner; +import com.azure.resourcemanager.newrelic.models.TagRule; +import com.azure.resourcemanager.newrelic.models.TagRules; + +public final class TagRulesImpl implements TagRules { + private static final ClientLogger LOGGER = new ClientLogger(TagRulesImpl.class); + + private final TagRulesClient innerClient; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + public TagRulesImpl(TagRulesClient innerClient, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByNewRelicMonitorResource(String resourceGroupName, String monitorName) { + PagedIterable inner = + this.serviceClient().listByNewRelicMonitorResource(resourceGroupName, monitorName); + return Utils.mapPage(inner, inner1 -> new TagRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByNewRelicMonitorResource( + String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = + this.serviceClient().listByNewRelicMonitorResource(resourceGroupName, monitorName, context); + return Utils.mapPage(inner, inner1 -> new TagRuleImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, monitorName, ruleSetName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TagRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TagRule get(String resourceGroupName, String monitorName, String ruleSetName) { + TagRuleInner inner = this.serviceClient().get(resourceGroupName, monitorName, ruleSetName); + if (inner != null) { + return new TagRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String monitorName, String ruleSetName) { + this.serviceClient().delete(resourceGroupName, monitorName, ruleSetName); + } + + public void delete(String resourceGroupName, String monitorName, String ruleSetName, Context context) { + this.serviceClient().delete(resourceGroupName, monitorName, ruleSetName, context); + } + + public TagRule getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String ruleSetName = Utils.getValueFromIdByName(id, "tagRules"); + if (ruleSetName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tagRules'.", id))); + } + return this.getWithResponse(resourceGroupName, monitorName, ruleSetName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String ruleSetName = Utils.getValueFromIdByName(id, "tagRules"); + if (ruleSetName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tagRules'.", id))); + } + return this.getWithResponse(resourceGroupName, monitorName, ruleSetName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String ruleSetName = Utils.getValueFromIdByName(id, "tagRules"); + if (ruleSetName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tagRules'.", id))); + } + this.delete(resourceGroupName, monitorName, ruleSetName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String ruleSetName = Utils.getValueFromIdByName(id, "tagRules"); + if (ruleSetName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tagRules'.", id))); + } + this.delete(resourceGroupName, monitorName, ruleSetName, context); + } + + private TagRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } + + public TagRuleImpl define(String name) { + return new TagRuleImpl(name, this.manager()); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/Utils.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/Utils.java new file mode 100644 index 000000000000..44d9ccdee894 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/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.newrelic.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/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/VMExtensionPayloadImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/VMExtensionPayloadImpl.java new file mode 100644 index 000000000000..eed4c911f128 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/VMExtensionPayloadImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.resourcemanager.newrelic.fluent.models.VMExtensionPayloadInner; +import com.azure.resourcemanager.newrelic.models.VMExtensionPayload; + +public final class VMExtensionPayloadImpl implements VMExtensionPayload { + private VMExtensionPayloadInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + VMExtensionPayloadImpl( + VMExtensionPayloadInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String ingestionKey() { + return this.innerModel().ingestionKey(); + } + + public VMExtensionPayloadInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/VMInfoImpl.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/VMInfoImpl.java new file mode 100644 index 000000000000..3ae56d5586a4 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/VMInfoImpl.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.implementation; + +import com.azure.resourcemanager.newrelic.fluent.models.VMInfoInner; +import com.azure.resourcemanager.newrelic.models.VMInfo; + +public final class VMInfoImpl implements VMInfo { + private VMInfoInner innerObject; + + private final com.azure.resourcemanager.newrelic.NewRelicManager serviceManager; + + VMInfoImpl(VMInfoInner innerObject, com.azure.resourcemanager.newrelic.NewRelicManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String vmId() { + return this.innerModel().vmId(); + } + + public String agentVersion() { + return this.innerModel().agentVersion(); + } + + public String agentStatus() { + return this.innerModel().agentStatus(); + } + + public VMInfoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelic.NewRelicManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/package-info.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/implementation/package-info.java new file mode 100644 index 000000000000..ea0d4556bbf9 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/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 NewRelicObservability. null. */ +package com.azure.resourcemanager.newrelic.implementation; diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AccountCreationSource.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AccountCreationSource.java new file mode 100644 index 000000000000..e984ea7041be --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AccountCreationSource.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Source of Account creation. */ +public final class AccountCreationSource extends ExpandableStringEnum { + /** Static value LIFTR for AccountCreationSource. */ + public static final AccountCreationSource LIFTR = fromString("LIFTR"); + + /** Static value NEWRELIC for AccountCreationSource. */ + public static final AccountCreationSource NEWRELIC = fromString("NEWRELIC"); + + /** + * Creates a new instance of AccountCreationSource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AccountCreationSource() { + } + + /** + * Creates or finds a AccountCreationSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccountCreationSource. + */ + @JsonCreator + public static AccountCreationSource fromString(String name) { + return fromString(name, AccountCreationSource.class); + } + + /** + * Gets known AccountCreationSource values. + * + * @return known AccountCreationSource values. + */ + public static Collection values() { + return values(AccountCreationSource.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AccountInfo.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AccountInfo.java new file mode 100644 index 000000000000..c48f5772bd76 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AccountInfo.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Account Info of the NewRelic account. */ +@Fluent +public final class AccountInfo { + /* + * Account id + */ + @JsonProperty(value = "accountId") + private String accountId; + + /* + * ingestion key of account + */ + @JsonProperty(value = "ingestionKey") + private String ingestionKey; + + /* + * NewRelic account region + */ + @JsonProperty(value = "region") + private String region; + + /** Creates an instance of AccountInfo class. */ + public AccountInfo() { + } + + /** + * Get the accountId property: Account id. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Set the accountId property: Account id. + * + * @param accountId the accountId value to set. + * @return the AccountInfo object itself. + */ + public AccountInfo withAccountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Get the ingestionKey property: ingestion key of account. + * + * @return the ingestionKey value. + */ + public String ingestionKey() { + return this.ingestionKey; + } + + /** + * Set the ingestionKey property: ingestion key of account. + * + * @param ingestionKey the ingestionKey value to set. + * @return the AccountInfo object itself. + */ + public AccountInfo withIngestionKey(String ingestionKey) { + this.ingestionKey = ingestionKey; + return this; + } + + /** + * Get the region property: NewRelic account region. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Set the region property: NewRelic account region. + * + * @param region the region value to set. + * @return the AccountInfo object itself. + */ + public AccountInfo withRegion(String region) { + this.region = region; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AccountResource.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AccountResource.java new file mode 100644 index 000000000000..aacd234a5c93 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AccountResource.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelic.fluent.models.AccountResourceInner; + +/** An immutable client-side representation of AccountResource. */ +public interface AccountResource { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the organizationId property: organization id. + * + * @return the organizationId value. + */ + String organizationId(); + + /** + * Gets the accountId property: account id. + * + * @return the accountId value. + */ + String accountId(); + + /** + * Gets the accountName property: account name. + * + * @return the accountName value. + */ + String accountName(); + + /** + * Gets the region property: region. + * + * @return the region value. + */ + String region(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.AccountResourceInner object. + * + * @return the inner object. + */ + AccountResourceInner innerModel(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Accounts.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Accounts.java new file mode 100644 index 000000000000..21e46433041e --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Accounts.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Accounts. */ +public interface Accounts { + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String userEmail, String location); + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String userEmail, String location, Context context); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AccountsListResponse.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AccountsListResponse.java new file mode 100644 index 000000000000..2db8ac51f8d7 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AccountsListResponse.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.fluent.models.AccountResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of get all accounts Operation. */ +@Fluent +public final class AccountsListResponse { + /* + * The AccountResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of AccountsListResponse class. */ + public AccountsListResponse() { + } + + /** + * Get the value property: The AccountResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The AccountResource items on this page. + * + * @param value the value value to set. + * @return the AccountsListResponse object itself. + */ + public AccountsListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the AccountsListResponse object itself. + */ + public AccountsListResponse 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model AccountsListResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AccountsListResponse.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/ActionType.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/ActionType.java new file mode 100644 index 000000000000..fcad8adfa685 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/ActionType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AppServiceInfo.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AppServiceInfo.java new file mode 100644 index 000000000000..4c75356f3c14 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AppServiceInfo.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.resourcemanager.newrelic.fluent.models.AppServiceInfoInner; + +/** An immutable client-side representation of AppServiceInfo. */ +public interface AppServiceInfo { + /** + * Gets the azureResourceId property: Azure App service resource ID. + * + * @return the azureResourceId value. + */ + String azureResourceId(); + + /** + * Gets the agentVersion property: Version of the NewRelic agent installed on the App service. + * + * @return the agentVersion value. + */ + String agentVersion(); + + /** + * Gets the agentStatus property: Status of the NewRelic agent installed on the App service. + * + * @return the agentStatus value. + */ + String agentStatus(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.AppServiceInfoInner object. + * + * @return the inner object. + */ + AppServiceInfoInner innerModel(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AppServicesGetRequest.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AppServicesGetRequest.java new file mode 100644 index 000000000000..6f949be5c19b --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AppServicesGetRequest.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Request of a app services get Operation. */ +@Fluent +public final class AppServicesGetRequest { + /* + * Azure resource IDs + */ + @JsonProperty(value = "azureResourceIds") + private List azureResourceIds; + + /* + * User Email + */ + @JsonProperty(value = "userEmail", required = true) + private String userEmail; + + /** Creates an instance of AppServicesGetRequest class. */ + public AppServicesGetRequest() { + } + + /** + * Get the azureResourceIds property: Azure resource IDs. + * + * @return the azureResourceIds value. + */ + public List azureResourceIds() { + return this.azureResourceIds; + } + + /** + * Set the azureResourceIds property: Azure resource IDs. + * + * @param azureResourceIds the azureResourceIds value to set. + * @return the AppServicesGetRequest object itself. + */ + public AppServicesGetRequest withAzureResourceIds(List azureResourceIds) { + this.azureResourceIds = azureResourceIds; + return this; + } + + /** + * Get the userEmail property: User Email. + * + * @return the userEmail value. + */ + public String userEmail() { + return this.userEmail; + } + + /** + * Set the userEmail property: User Email. + * + * @param userEmail the userEmail value to set. + * @return the AppServicesGetRequest object itself. + */ + public AppServicesGetRequest withUserEmail(String userEmail) { + this.userEmail = userEmail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userEmail() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property userEmail in model AppServicesGetRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AppServicesGetRequest.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AppServicesListResponse.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AppServicesListResponse.java new file mode 100644 index 000000000000..86163c24493a --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/AppServicesListResponse.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.fluent.models.AppServiceInfoInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of a list app services Operation. */ +@Fluent +public final class AppServicesListResponse { + /* + * The AppServiceInfo items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of AppServicesListResponse class. */ + public AppServicesListResponse() { + } + + /** + * Get the value property: The AppServiceInfo items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The AppServiceInfo items on this page. + * + * @param value the value value to set. + * @return the AppServicesListResponse object itself. + */ + public AppServicesListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the AppServicesListResponse object itself. + */ + public AppServicesListResponse 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model AppServicesListResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AppServicesListResponse.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/BillingCycle.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/BillingCycle.java new file mode 100644 index 000000000000..a3d649cff3ca --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/BillingCycle.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Different usage type like YEARLY/MONTHLY. */ +public final class BillingCycle extends ExpandableStringEnum { + /** Static value YEARLY for BillingCycle. */ + public static final BillingCycle YEARLY = fromString("YEARLY"); + + /** Static value MONTHLY for BillingCycle. */ + public static final BillingCycle MONTHLY = fromString("MONTHLY"); + + /** Static value WEEKLY for BillingCycle. */ + public static final BillingCycle WEEKLY = fromString("WEEKLY"); + + /** + * Creates a new instance of BillingCycle value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BillingCycle() { + } + + /** + * Creates or finds a BillingCycle from its string representation. + * + * @param name a name to look for. + * @return the corresponding BillingCycle. + */ + @JsonCreator + public static BillingCycle fromString(String name) { + return fromString(name, BillingCycle.class); + } + + /** + * Gets known BillingCycle values. + * + * @return known BillingCycle values. + */ + public static Collection values() { + return values(BillingCycle.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/BillingSource.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/BillingSource.java new file mode 100644 index 000000000000..614567623eea --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/BillingSource.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Billing source. */ +public final class BillingSource extends ExpandableStringEnum { + /** Static value AZURE for BillingSource. */ + public static final BillingSource AZURE = fromString("AZURE"); + + /** Static value NEWRELIC for BillingSource. */ + public static final BillingSource NEWRELIC = fromString("NEWRELIC"); + + /** + * Creates a new instance of BillingSource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BillingSource() { + } + + /** + * Creates or finds a BillingSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding BillingSource. + */ + @JsonCreator + public static BillingSource fromString(String name) { + return fromString(name, BillingSource.class); + } + + /** + * Gets known BillingSource values. + * + * @return known BillingSource values. + */ + public static Collection values() { + return values(BillingSource.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/FilteringTag.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/FilteringTag.java new file mode 100644 index 000000000000..b4cfd4f3a567 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/FilteringTag.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.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them from + * being monitored. + */ +@Fluent +public final class FilteringTag { + /* + * The name (also known as the key) of the tag. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value of the tag. + */ + @JsonProperty(value = "value") + private String value; + + /* + * Valid actions for a filtering tag. Exclusion takes priority over inclusion. + */ + @JsonProperty(value = "action") + private TagAction action; + + /** Creates an instance of FilteringTag class. */ + public FilteringTag() { + } + + /** + * Get the name property: The name (also known as the key) of the tag. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name (also known as the key) of the tag. + * + * @param name the name value to set. + * @return the FilteringTag object itself. + */ + public FilteringTag withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the tag. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the tag. + * + * @param value the value value to set. + * @return the FilteringTag object itself. + */ + public FilteringTag withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the action property: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + * + * @return the action value. + */ + public TagAction action() { + return this.action; + } + + /** + * Set the action property: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + * + * @param action the action value to set. + * @return the FilteringTag object itself. + */ + public FilteringTag withAction(TagAction action) { + this.action = action; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/HostsGetRequest.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/HostsGetRequest.java new file mode 100644 index 000000000000..a2487bac2847 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/HostsGetRequest.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Request of a Hosts get Operation. */ +@Fluent +public final class HostsGetRequest { + /* + * VM resource IDs + */ + @JsonProperty(value = "vmIds") + private List vmIds; + + /* + * User Email + */ + @JsonProperty(value = "userEmail", required = true) + private String userEmail; + + /** Creates an instance of HostsGetRequest class. */ + public HostsGetRequest() { + } + + /** + * Get the vmIds property: VM resource IDs. + * + * @return the vmIds value. + */ + public List vmIds() { + return this.vmIds; + } + + /** + * Set the vmIds property: VM resource IDs. + * + * @param vmIds the vmIds value to set. + * @return the HostsGetRequest object itself. + */ + public HostsGetRequest withVmIds(List vmIds) { + this.vmIds = vmIds; + return this; + } + + /** + * Get the userEmail property: User Email. + * + * @return the userEmail value. + */ + public String userEmail() { + return this.userEmail; + } + + /** + * Set the userEmail property: User Email. + * + * @param userEmail the userEmail value to set. + * @return the HostsGetRequest object itself. + */ + public HostsGetRequest withUserEmail(String userEmail) { + this.userEmail = userEmail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userEmail() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property userEmail in model HostsGetRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HostsGetRequest.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/LiftrResourceCategories.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/LiftrResourceCategories.java new file mode 100644 index 000000000000..fcbc28187ab9 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/LiftrResourceCategories.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Liftr Resource category. */ +public final class LiftrResourceCategories extends ExpandableStringEnum { + /** Static value Unknown for LiftrResourceCategories. */ + public static final LiftrResourceCategories UNKNOWN = fromString("Unknown"); + + /** Static value MonitorLogs for LiftrResourceCategories. */ + public static final LiftrResourceCategories MONITOR_LOGS = fromString("MonitorLogs"); + + /** + * Creates a new instance of LiftrResourceCategories value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LiftrResourceCategories() { + } + + /** + * Creates or finds a LiftrResourceCategories from its string representation. + * + * @param name a name to look for. + * @return the corresponding LiftrResourceCategories. + */ + @JsonCreator + public static LiftrResourceCategories fromString(String name) { + return fromString(name, LiftrResourceCategories.class); + } + + /** + * Gets known LiftrResourceCategories values. + * + * @return known LiftrResourceCategories values. + */ + public static Collection values() { + return values(LiftrResourceCategories.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/LogRules.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/LogRules.java new file mode 100644 index 000000000000..a803ae38a400 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/LogRules.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Set of rules for sending logs for the Monitor resource. */ +@Fluent +public final class LogRules { + /* + * Flag specifying if AAD logs should be sent for the Monitor resource. + */ + @JsonProperty(value = "sendAadLogs") + private SendAadLogsStatus sendAadLogs; + + /* + * Flag specifying if subscription logs should be sent for the Monitor resource. + */ + @JsonProperty(value = "sendSubscriptionLogs") + private SendSubscriptionLogsStatus sendSubscriptionLogs; + + /* + * Flag specifying if activity logs from Azure resources should be sent for the Monitor resource. + */ + @JsonProperty(value = "sendActivityLogs") + private SendActivityLogsStatus sendActivityLogs; + + /* + * List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is + * enabled. If empty, all resources will be captured. + * If only Exclude action is specified, the rules will apply to the list of all available resources. If Include + * actions are specified, the rules will only include resources with the associated tags. + */ + @JsonProperty(value = "filteringTags") + private List filteringTags; + + /** Creates an instance of LogRules class. */ + public LogRules() { + } + + /** + * Get the sendAadLogs property: Flag specifying if AAD logs should be sent for the Monitor resource. + * + * @return the sendAadLogs value. + */ + public SendAadLogsStatus sendAadLogs() { + return this.sendAadLogs; + } + + /** + * Set the sendAadLogs property: Flag specifying if AAD logs should be sent for the Monitor resource. + * + * @param sendAadLogs the sendAadLogs value to set. + * @return the LogRules object itself. + */ + public LogRules withSendAadLogs(SendAadLogsStatus sendAadLogs) { + this.sendAadLogs = sendAadLogs; + return this; + } + + /** + * Get the sendSubscriptionLogs property: Flag specifying if subscription logs should be sent for the Monitor + * resource. + * + * @return the sendSubscriptionLogs value. + */ + public SendSubscriptionLogsStatus sendSubscriptionLogs() { + return this.sendSubscriptionLogs; + } + + /** + * Set the sendSubscriptionLogs property: Flag specifying if subscription logs should be sent for the Monitor + * resource. + * + * @param sendSubscriptionLogs the sendSubscriptionLogs value to set. + * @return the LogRules object itself. + */ + public LogRules withSendSubscriptionLogs(SendSubscriptionLogsStatus sendSubscriptionLogs) { + this.sendSubscriptionLogs = sendSubscriptionLogs; + return this; + } + + /** + * Get the sendActivityLogs property: Flag specifying if activity logs from Azure resources should be sent for the + * Monitor resource. + * + * @return the sendActivityLogs value. + */ + public SendActivityLogsStatus sendActivityLogs() { + return this.sendActivityLogs; + } + + /** + * Set the sendActivityLogs property: Flag specifying if activity logs from Azure resources should be sent for the + * Monitor resource. + * + * @param sendActivityLogs the sendActivityLogs value to set. + * @return the LogRules object itself. + */ + public LogRules withSendActivityLogs(SendActivityLogsStatus sendActivityLogs) { + this.sendActivityLogs = sendActivityLogs; + return this; + } + + /** + * Get the filteringTags property: List of filtering tags to be used for capturing logs. This only takes effect if + * SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, + * the rules will apply to the list of all available resources. If Include actions are specified, the rules will + * only include resources with the associated tags. + * + * @return the filteringTags value. + */ + public List filteringTags() { + return this.filteringTags; + } + + /** + * Set the filteringTags property: List of filtering tags to be used for capturing logs. This only takes effect if + * SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, + * the rules will apply to the list of all available resources. If Include actions are specified, the rules will + * only include resources with the associated tags. + * + * @param filteringTags the filteringTags value to set. + * @return the LogRules object itself. + */ + public LogRules withFilteringTags(List filteringTags) { + this.filteringTags = filteringTags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (filteringTags() != null) { + filteringTags().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/ManagedServiceIdentity.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..d29be2f17bdc --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/ManagedServiceIdentity.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Managed service identity (system assigned and/or user assigned identities). */ +@Fluent +public class ManagedServiceIdentity { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ + @JsonProperty(value = "type", required = true) + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys + * will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** Creates an instance of ManagedServiceIdentity class. */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/ManagedServiceIdentityType.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..cc16564a3e35 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/ManagedServiceIdentityType.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.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** Static value None for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** Static value SystemAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** Static value SystemAssigned, UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = + fromString("SystemAssigned, UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + @JsonCreator + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MarketplaceSubscriptionStatus.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MarketplaceSubscriptionStatus.java new file mode 100644 index 000000000000..8317252d773f --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MarketplaceSubscriptionStatus.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource + * will go in Suspended state. + */ +public final class MarketplaceSubscriptionStatus extends ExpandableStringEnum { + /** Static value Active for MarketplaceSubscriptionStatus. */ + public static final MarketplaceSubscriptionStatus ACTIVE = fromString("Active"); + + /** Static value Suspended for MarketplaceSubscriptionStatus. */ + public static final MarketplaceSubscriptionStatus SUSPENDED = fromString("Suspended"); + + /** + * Creates a new instance of MarketplaceSubscriptionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MarketplaceSubscriptionStatus() { + } + + /** + * Creates or finds a MarketplaceSubscriptionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MarketplaceSubscriptionStatus. + */ + @JsonCreator + public static MarketplaceSubscriptionStatus fromString(String name) { + return fromString(name, MarketplaceSubscriptionStatus.class); + } + + /** + * Gets known MarketplaceSubscriptionStatus values. + * + * @return known MarketplaceSubscriptionStatus values. + */ + public static Collection values() { + return values(MarketplaceSubscriptionStatus.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MetricRules.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MetricRules.java new file mode 100644 index 000000000000..adc87f0bbb3f --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MetricRules.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import java.util.List; + +/** An immutable client-side representation of MetricRules. */ +public interface MetricRules { + /** + * Gets the sendMetrics property: Flag specifying if metrics should be sent for the Monitor resource. + * + * @return the sendMetrics value. + */ + SendMetricsStatus sendMetrics(); + + /** + * Gets the filteringTags property: List of filtering tags to be used for capturing metrics. + * + * @return the filteringTags value. + */ + List filteringTags(); + + /** + * Gets the userEmail property: User Email. + * + * @return the userEmail value. + */ + String userEmail(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner object. + * + * @return the inner object. + */ + MetricRulesInner innerModel(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MetricsRequest.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MetricsRequest.java new file mode 100644 index 000000000000..318dfe946883 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MetricsRequest.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.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request of get metrics Operation. */ +@Fluent +public final class MetricsRequest { + /* + * User Email + */ + @JsonProperty(value = "userEmail", required = true) + private String userEmail; + + /** Creates an instance of MetricsRequest class. */ + public MetricsRequest() { + } + + /** + * Get the userEmail property: User Email. + * + * @return the userEmail value. + */ + public String userEmail() { + return this.userEmail; + } + + /** + * Set the userEmail property: User Email. + * + * @param userEmail the userEmail value to set. + * @return the MetricsRequest object itself. + */ + public MetricsRequest withUserEmail(String userEmail) { + this.userEmail = userEmail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userEmail() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property userEmail in model MetricsRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricsRequest.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MetricsStatusRequest.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MetricsStatusRequest.java new file mode 100644 index 000000000000..ae3f84cf4f5b --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MetricsStatusRequest.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Request of get metrics status Operation. */ +@Fluent +public final class MetricsStatusRequest { + /* + * Azure resource IDs + */ + @JsonProperty(value = "azureResourceIds") + private List azureResourceIds; + + /* + * User Email + */ + @JsonProperty(value = "userEmail", required = true) + private String userEmail; + + /** Creates an instance of MetricsStatusRequest class. */ + public MetricsStatusRequest() { + } + + /** + * Get the azureResourceIds property: Azure resource IDs. + * + * @return the azureResourceIds value. + */ + public List azureResourceIds() { + return this.azureResourceIds; + } + + /** + * Set the azureResourceIds property: Azure resource IDs. + * + * @param azureResourceIds the azureResourceIds value to set. + * @return the MetricsStatusRequest object itself. + */ + public MetricsStatusRequest withAzureResourceIds(List azureResourceIds) { + this.azureResourceIds = azureResourceIds; + return this; + } + + /** + * Get the userEmail property: User Email. + * + * @return the userEmail value. + */ + public String userEmail() { + return this.userEmail; + } + + /** + * Set the userEmail property: User Email. + * + * @param userEmail the userEmail value to set. + * @return the MetricsStatusRequest object itself. + */ + public MetricsStatusRequest withUserEmail(String userEmail) { + this.userEmail = userEmail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userEmail() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property userEmail in model MetricsStatusRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricsStatusRequest.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MetricsStatusResponse.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MetricsStatusResponse.java new file mode 100644 index 000000000000..42744c59b853 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MetricsStatusResponse.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.resourcemanager.newrelic.fluent.models.MetricsStatusResponseInner; +import java.util.List; + +/** An immutable client-side representation of MetricsStatusResponse. */ +public interface MetricsStatusResponse { + /** + * Gets the azureResourceIds property: Azure resource IDs. + * + * @return the azureResourceIds value. + */ + List azureResourceIds(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.MetricsStatusResponseInner object. + * + * @return the inner object. + */ + MetricsStatusResponseInner innerModel(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MonitoredResource.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MonitoredResource.java new file mode 100644 index 000000000000..d4654e0b2ef9 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MonitoredResource.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.newrelic.models; + +import com.azure.resourcemanager.newrelic.fluent.models.MonitoredResourceInner; + +/** An immutable client-side representation of MonitoredResource. */ +public interface MonitoredResource { + /** + * Gets the id property: The ARM id of the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the sendingMetrics property: Flag indicating if resource is sending metrics to NewRelic. + * + * @return the sendingMetrics value. + */ + SendingMetricsStatus sendingMetrics(); + + /** + * Gets the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not + * sending). + * + * @return the reasonForMetricsStatus value. + */ + String reasonForMetricsStatus(); + + /** + * Gets the sendingLogs property: Flag indicating if resource is sending logs to NewRelic. + * + * @return the sendingLogs value. + */ + SendingLogsStatus sendingLogs(); + + /** + * Gets the reasonForLogsStatus property: Reason for why the resource is sending logs (or why it is not sending). + * + * @return the reasonForLogsStatus value. + */ + String reasonForLogsStatus(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.MonitoredResourceInner object. + * + * @return the inner object. + */ + MonitoredResourceInner innerModel(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MonitoredResourceListResponse.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MonitoredResourceListResponse.java new file mode 100644 index 000000000000..db8426b47de6 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MonitoredResourceListResponse.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.fluent.models.MonitoredResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of all the resources being monitored by NewRelic monitor resource. */ +@Fluent +public final class MonitoredResourceListResponse { + /* + * The MonitoredResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of MonitoredResourceListResponse class. */ + public MonitoredResourceListResponse() { + } + + /** + * Get the value property: The MonitoredResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The MonitoredResource items on this page. + * + * @param value the value value to set. + * @return the MonitoredResourceListResponse object itself. + */ + public MonitoredResourceListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the MonitoredResourceListResponse object itself. + */ + public MonitoredResourceListResponse 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model MonitoredResourceListResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MonitoredResourceListResponse.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MonitoringStatus.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MonitoringStatus.java new file mode 100644 index 000000000000..b33bdc48b592 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MonitoringStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Flag specifying if the resource monitoring is enabled or disabled. */ +public final class MonitoringStatus extends ExpandableStringEnum { + /** Static value Enabled for MonitoringStatus. */ + public static final MonitoringStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for MonitoringStatus. */ + public static final MonitoringStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of MonitoringStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MonitoringStatus() { + } + + /** + * Creates or finds a MonitoringStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MonitoringStatus. + */ + @JsonCreator + public static MonitoringStatus fromString(String name) { + return fromString(name, MonitoringStatus.class); + } + + /** + * Gets known MonitoringStatus values. + * + * @return known MonitoringStatus values. + */ + public static Collection values() { + return values(MonitoringStatus.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MonitoringTagRulesProperties.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MonitoringTagRulesProperties.java new file mode 100644 index 000000000000..b0ed723a7fb3 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/MonitoringTagRulesProperties.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.resourcemanager.newrelic.fluent.models.MonitoringTagRulesPropertiesInner; + +/** An immutable client-side representation of MonitoringTagRulesProperties. */ +public interface MonitoringTagRulesProperties { + /** + * Gets the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + LogRules logRules(); + + /** + * Gets the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + MetricRules metricRules(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.MonitoringTagRulesPropertiesInner object. + * + * @return the inner object. + */ + MonitoringTagRulesPropertiesInner innerModel(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Monitors.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Monitors.java new file mode 100644 index 000000000000..7762958c3d6b --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Monitors.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Monitors. */ +public interface Monitors { + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context); + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource. + */ + NewRelicMonitorResource getByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String userEmail, String monitorName); + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String userEmail, String monitorName, Context context); + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric rules along with {@link Response}. + */ + Response getMetricRulesWithResponse( + String resourceGroupName, String monitorName, MetricsRequest request, Context context); + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric rules. + */ + MetricRules getMetricRules(String resourceGroupName, String monitorName, MetricsRequest request); + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric status along with {@link Response}. + */ + Response getMetricStatusWithResponse( + String resourceGroupName, String monitorName, MetricsStatusRequest request, Context context); + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status 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 metric status. + */ + MetricsStatusResponse getMetricStatus(String resourceGroupName, String monitorName, MetricsStatusRequest request); + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get 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 response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request); + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get 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 response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request, Context context); + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing 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 switchBillingWithResponse( + String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context); + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing 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 switchBilling(String resourceGroupName, String monitorName, SwitchBillingRequest request); + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get 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 response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listHosts(String resourceGroupName, String monitorName, HostsGetRequest request); + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get 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 response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listHosts( + String resourceGroupName, String monitorName, HostsGetRequest request, Context context); + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listMonitoredResources(String resourceGroupName, String monitorName); + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, Context context); + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of payload to be passed while installing VM agent along with {@link Response}. + */ + Response vmHostPayloadWithResponse( + String resourceGroupName, String monitorName, Context context); + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of payload to be passed while installing VM agent. + */ + VMExtensionPayload vmHostPayload(String resourceGroupName, String monitorName); + + /** + * Get a NewRelicMonitorResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response}. + */ + NewRelicMonitorResource getById(String id); + + /** + * Get a NewRelicMonitorResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new NewRelicMonitorResource resource. + * + * @param name resource name. + * @return the first stage of the new NewRelicMonitorResource definition. + */ + NewRelicMonitorResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicAccountProperties.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicAccountProperties.java new file mode 100644 index 000000000000..faa4c53b0a9e --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicAccountProperties.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.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the NewRelic account. */ +@Fluent +public final class NewRelicAccountProperties { + /* + * User id + */ + @JsonProperty(value = "userId") + private String userId; + + /* + * NewRelic Account Information + */ + @JsonProperty(value = "accountInfo") + private AccountInfo accountInfo; + + /* + * NewRelic Organization Information + */ + @JsonProperty(value = "organizationInfo") + private OrganizationInfo organizationInfo; + + /* + * date when plan was applied + */ + @JsonProperty(value = "singleSignOnProperties") + private NewRelicSingleSignOnProperties singleSignOnProperties; + + /** Creates an instance of NewRelicAccountProperties class. */ + public NewRelicAccountProperties() { + } + + /** + * Get the userId property: User id. + * + * @return the userId value. + */ + public String userId() { + return this.userId; + } + + /** + * Set the userId property: User id. + * + * @param userId the userId value to set. + * @return the NewRelicAccountProperties object itself. + */ + public NewRelicAccountProperties withUserId(String userId) { + this.userId = userId; + return this; + } + + /** + * Get the accountInfo property: NewRelic Account Information. + * + * @return the accountInfo value. + */ + public AccountInfo accountInfo() { + return this.accountInfo; + } + + /** + * Set the accountInfo property: NewRelic Account Information. + * + * @param accountInfo the accountInfo value to set. + * @return the NewRelicAccountProperties object itself. + */ + public NewRelicAccountProperties withAccountInfo(AccountInfo accountInfo) { + this.accountInfo = accountInfo; + return this; + } + + /** + * Get the organizationInfo property: NewRelic Organization Information. + * + * @return the organizationInfo value. + */ + public OrganizationInfo organizationInfo() { + return this.organizationInfo; + } + + /** + * Set the organizationInfo property: NewRelic Organization Information. + * + * @param organizationInfo the organizationInfo value to set. + * @return the NewRelicAccountProperties object itself. + */ + public NewRelicAccountProperties withOrganizationInfo(OrganizationInfo organizationInfo) { + this.organizationInfo = organizationInfo; + return this; + } + + /** + * Get the singleSignOnProperties property: date when plan was applied. + * + * @return the singleSignOnProperties value. + */ + public NewRelicSingleSignOnProperties singleSignOnProperties() { + return this.singleSignOnProperties; + } + + /** + * Set the singleSignOnProperties property: date when plan was applied. + * + * @param singleSignOnProperties the singleSignOnProperties value to set. + * @return the NewRelicAccountProperties object itself. + */ + public NewRelicAccountProperties withSingleSignOnProperties(NewRelicSingleSignOnProperties singleSignOnProperties) { + this.singleSignOnProperties = singleSignOnProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (accountInfo() != null) { + accountInfo().validate(); + } + if (organizationInfo() != null) { + organizationInfo().validate(); + } + if (singleSignOnProperties() != null) { + singleSignOnProperties().validate(); + } + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicMonitorResource.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicMonitorResource.java new file mode 100644 index 000000000000..8f50846b9ed9 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicMonitorResource.java @@ -0,0 +1,583 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelic.fluent.models.NewRelicMonitorResourceInner; +import java.util.Map; + +/** An immutable client-side representation of NewRelicMonitorResource. */ +public interface NewRelicMonitorResource { + /** + * 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 identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the monitoringStatus property: MonitoringStatus of the resource. + * + * @return the monitoringStatus value. + */ + MonitoringStatus monitoringStatus(); + + /** + * Gets the marketplaceSubscriptionStatus property: NewRelic Organization properties of the resource. + * + * @return the marketplaceSubscriptionStatus value. + */ + MarketplaceSubscriptionStatus marketplaceSubscriptionStatus(); + + /** + * Gets the marketplaceSubscriptionId property: Marketplace Subscription Id. + * + * @return the marketplaceSubscriptionId value. + */ + String marketplaceSubscriptionId(); + + /** + * Gets the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @return the newRelicAccountProperties value. + */ + NewRelicAccountProperties newRelicAccountProperties(); + + /** + * Gets the userInfo property: User Info. + * + * @return the userInfo value. + */ + UserInfo userInfo(); + + /** + * Gets the planData property: Plan details. + * + * @return the planData value. + */ + PlanData planData(); + + /** + * Gets the liftrResourceCategory property: Liftr resource category. + * + * @return the liftrResourceCategory value. + */ + LiftrResourceCategories liftrResourceCategory(); + + /** + * Gets the liftrResourcePreference property: Liftr resource preference. The priority of the resource. + * + * @return the liftrResourcePreference value. + */ + Integer liftrResourcePreference(); + + /** + * Gets the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + OrgCreationSource orgCreationSource(); + + /** + * Gets the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + AccountCreationSource accountCreationSource(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.NewRelicMonitorResourceInner object. + * + * @return the inner object. + */ + NewRelicMonitorResourceInner innerModel(); + + /** The entirety of the NewRelicMonitorResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The NewRelicMonitorResource definition stages. */ + interface DefinitionStages { + /** The first stage of the NewRelicMonitorResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the NewRelicMonitorResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the NewRelicMonitorResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithNewRelicAccountProperties, + DefinitionStages.WithUserInfo, + DefinitionStages.WithPlanData, + DefinitionStages.WithOrgCreationSource, + DefinitionStages.WithAccountCreationSource { + /** + * Executes the create request. + * + * @return the created resource. + */ + NewRelicMonitorResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NewRelicMonitorResource create(Context context); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify newRelicAccountProperties. */ + interface WithNewRelicAccountProperties { + /** + * Specifies the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @param newRelicAccountProperties MarketplaceSubscriptionStatus of the resource. + * @return the next definition stage. + */ + WithCreate withNewRelicAccountProperties(NewRelicAccountProperties newRelicAccountProperties); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify userInfo. */ + interface WithUserInfo { + /** + * Specifies the userInfo property: User Info. + * + * @param userInfo User Info. + * @return the next definition stage. + */ + WithCreate withUserInfo(UserInfo userInfo); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify planData. */ + interface WithPlanData { + /** + * Specifies the planData property: Plan details. + * + * @param planData Plan details. + * @return the next definition stage. + */ + WithCreate withPlanData(PlanData planData); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify orgCreationSource. */ + interface WithOrgCreationSource { + /** + * Specifies the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource Source of org creation. + * @return the next definition stage. + */ + WithCreate withOrgCreationSource(OrgCreationSource orgCreationSource); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify accountCreationSource. */ + interface WithAccountCreationSource { + /** + * Specifies the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource Source of account creation. + * @return the next definition stage. + */ + WithCreate withAccountCreationSource(AccountCreationSource accountCreationSource); + } + } + /** + * Begins update for the NewRelicMonitorResource resource. + * + * @return the stage of resource update. + */ + NewRelicMonitorResource.Update update(); + + /** The template for NewRelicMonitorResource update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithIdentity, + UpdateStages.WithNewRelicAccountProperties, + UpdateStages.WithUserInfo, + UpdateStages.WithPlanData, + UpdateStages.WithOrgCreationSource, + UpdateStages.WithAccountCreationSource { + /** + * Executes the update request. + * + * @return the updated resource. + */ + NewRelicMonitorResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + NewRelicMonitorResource apply(Context context); + } + /** The NewRelicMonitorResource update stages. */ + interface UpdateStages { + /** The stage of the NewRelicMonitorResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the NewRelicMonitorResource update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the NewRelicMonitorResource update allowing to specify newRelicAccountProperties. */ + interface WithNewRelicAccountProperties { + /** + * Specifies the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @param newRelicAccountProperties MarketplaceSubscriptionStatus of the resource. + * @return the next definition stage. + */ + Update withNewRelicAccountProperties(NewRelicAccountProperties newRelicAccountProperties); + } + /** The stage of the NewRelicMonitorResource update allowing to specify userInfo. */ + interface WithUserInfo { + /** + * Specifies the userInfo property: User Info. + * + * @param userInfo User Info. + * @return the next definition stage. + */ + Update withUserInfo(UserInfo userInfo); + } + /** The stage of the NewRelicMonitorResource update allowing to specify planData. */ + interface WithPlanData { + /** + * Specifies the planData property: Plan details. + * + * @param planData Plan details. + * @return the next definition stage. + */ + Update withPlanData(PlanData planData); + } + /** The stage of the NewRelicMonitorResource update allowing to specify orgCreationSource. */ + interface WithOrgCreationSource { + /** + * Specifies the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource Source of org creation. + * @return the next definition stage. + */ + Update withOrgCreationSource(OrgCreationSource orgCreationSource); + } + /** The stage of the NewRelicMonitorResource update allowing to specify accountCreationSource. */ + interface WithAccountCreationSource { + /** + * Specifies the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource Source of account creation. + * @return the next definition stage. + */ + Update withAccountCreationSource(AccountCreationSource accountCreationSource); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + NewRelicMonitorResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + NewRelicMonitorResource refresh(Context context); + + /** + * Get metric rules. + * + * @param request The details of the get metrics status 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 metric rules along with {@link Response}. + */ + Response getMetricRulesWithResponse(MetricsRequest request, Context context); + + /** + * Get metric rules. + * + * @param request The details of the get metrics status 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 metric rules. + */ + MetricRules getMetricRules(MetricsRequest request); + + /** + * Get metric status. + * + * @param request The details of the get metrics status 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 metric status along with {@link Response}. + */ + Response getMetricStatusWithResponse(MetricsStatusRequest request, Context context); + + /** + * Get metric status. + * + * @param request The details of the get metrics status 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 metric status. + */ + MetricsStatusResponse getMetricStatus(MetricsStatusRequest request); + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param request The details of the app services get 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 response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listAppServices(AppServicesGetRequest request); + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param request The details of the app services get 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 response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listAppServices(AppServicesGetRequest request, Context context); + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param request The details of the switch billing 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 switchBillingWithResponse(SwitchBillingRequest request, Context context); + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param request The details of the switch billing 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 switchBilling(SwitchBillingRequest request); + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param request The details of the Hosts get 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 response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listHosts(HostsGetRequest request); + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param request The details of the Hosts get 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 response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listHosts(HostsGetRequest request, Context context); + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listMonitoredResources(); + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listMonitoredResources(Context context); + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of payload to be passed while installing VM agent along with {@link Response}. + */ + Response vmHostPayloadWithResponse(Context context); + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of payload to be passed while installing VM agent. + */ + VMExtensionPayload vmHostPayload(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicMonitorResourceListResult.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicMonitorResourceListResult.java new file mode 100644 index 000000000000..9e8647927900 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicMonitorResourceListResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.fluent.models.NewRelicMonitorResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a NewRelicMonitorResource list operation. */ +@Fluent +public final class NewRelicMonitorResourceListResult { + /* + * The NewRelicMonitorResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of NewRelicMonitorResourceListResult class. */ + public NewRelicMonitorResourceListResult() { + } + + /** + * Get the value property: The NewRelicMonitorResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The NewRelicMonitorResource items on this page. + * + * @param value the value value to set. + * @return the NewRelicMonitorResourceListResult object itself. + */ + public NewRelicMonitorResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the NewRelicMonitorResourceListResult object itself. + */ + public NewRelicMonitorResourceListResult 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model NewRelicMonitorResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NewRelicMonitorResourceListResult.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicMonitorResourceUpdate.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicMonitorResourceUpdate.java new file mode 100644 index 000000000000..49b857ae709f --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicMonitorResourceUpdate.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelic.fluent.models.NewRelicMonitorResourceUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The type used for update operations of the NewRelicMonitorResource. */ +@Fluent +public final class NewRelicMonitorResourceUpdate { + /* + * The managed service identities assigned to this resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The updatable properties of the NewRelicMonitorResource. + */ + @JsonProperty(value = "properties") + private NewRelicMonitorResourceUpdateProperties innerProperties; + + /** Creates an instance of NewRelicMonitorResourceUpdate class. */ + public NewRelicMonitorResourceUpdate() { + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * 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 NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The updatable properties of the NewRelicMonitorResource. + * + * @return the innerProperties value. + */ + private NewRelicMonitorResourceUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @return the newRelicAccountProperties value. + */ + public NewRelicAccountProperties newRelicAccountProperties() { + return this.innerProperties() == null ? null : this.innerProperties().newRelicAccountProperties(); + } + + /** + * Set the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @param newRelicAccountProperties the newRelicAccountProperties value to set. + * @return the NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withNewRelicAccountProperties( + NewRelicAccountProperties newRelicAccountProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new NewRelicMonitorResourceUpdateProperties(); + } + this.innerProperties().withNewRelicAccountProperties(newRelicAccountProperties); + return this; + } + + /** + * Get the userInfo property: User Info. + * + * @return the userInfo value. + */ + public UserInfo userInfo() { + return this.innerProperties() == null ? null : this.innerProperties().userInfo(); + } + + /** + * Set the userInfo property: User Info. + * + * @param userInfo the userInfo value to set. + * @return the NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withUserInfo(UserInfo userInfo) { + if (this.innerProperties() == null) { + this.innerProperties = new NewRelicMonitorResourceUpdateProperties(); + } + this.innerProperties().withUserInfo(userInfo); + return this; + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.innerProperties() == null ? null : this.innerProperties().planData(); + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withPlanData(PlanData planData) { + if (this.innerProperties() == null) { + this.innerProperties = new NewRelicMonitorResourceUpdateProperties(); + } + this.innerProperties().withPlanData(planData); + return this; + } + + /** + * Get the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + public OrgCreationSource orgCreationSource() { + return this.innerProperties() == null ? null : this.innerProperties().orgCreationSource(); + } + + /** + * Set the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource the orgCreationSource value to set. + * @return the NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withOrgCreationSource(OrgCreationSource orgCreationSource) { + if (this.innerProperties() == null) { + this.innerProperties = new NewRelicMonitorResourceUpdateProperties(); + } + this.innerProperties().withOrgCreationSource(orgCreationSource); + return this; + } + + /** + * Get the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + public AccountCreationSource accountCreationSource() { + return this.innerProperties() == null ? null : this.innerProperties().accountCreationSource(); + } + + /** + * Set the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource the accountCreationSource value to set. + * @return the NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withAccountCreationSource(AccountCreationSource accountCreationSource) { + if (this.innerProperties() == null) { + this.innerProperties = new NewRelicMonitorResourceUpdateProperties(); + } + this.innerProperties().withAccountCreationSource(accountCreationSource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicSingleSignOnProperties.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicSingleSignOnProperties.java new file mode 100644 index 000000000000..9c76d2e0c637 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/NewRelicSingleSignOnProperties.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Single sign on Info of the NewRelic account. */ +@Fluent +public final class NewRelicSingleSignOnProperties { + /* + * Single sign-on state + */ + @JsonProperty(value = "singleSignOnState") + private SingleSignOnStates singleSignOnState; + + /* + * The Id of the Enterprise App used for Single sign-on. + */ + @JsonProperty(value = "enterpriseAppId") + private String enterpriseAppId; + + /* + * The login URL specific to this NewRelic Organization + */ + @JsonProperty(value = "singleSignOnUrl") + private String singleSignOnUrl; + + /* + * Provisioning state + */ + @JsonProperty(value = "provisioningState") + private ProvisioningState provisioningState; + + /** Creates an instance of NewRelicSingleSignOnProperties class. */ + public NewRelicSingleSignOnProperties() { + } + + /** + * Get the singleSignOnState property: Single sign-on state. + * + * @return the singleSignOnState value. + */ + public SingleSignOnStates singleSignOnState() { + return this.singleSignOnState; + } + + /** + * Set the singleSignOnState property: Single sign-on state. + * + * @param singleSignOnState the singleSignOnState value to set. + * @return the NewRelicSingleSignOnProperties object itself. + */ + public NewRelicSingleSignOnProperties withSingleSignOnState(SingleSignOnStates singleSignOnState) { + this.singleSignOnState = singleSignOnState; + return this; + } + + /** + * Get the enterpriseAppId property: The Id of the Enterprise App used for Single sign-on. + * + * @return the enterpriseAppId value. + */ + public String enterpriseAppId() { + return this.enterpriseAppId; + } + + /** + * Set the enterpriseAppId property: The Id of the Enterprise App used for Single sign-on. + * + * @param enterpriseAppId the enterpriseAppId value to set. + * @return the NewRelicSingleSignOnProperties object itself. + */ + public NewRelicSingleSignOnProperties withEnterpriseAppId(String enterpriseAppId) { + this.enterpriseAppId = enterpriseAppId; + return this; + } + + /** + * Get the singleSignOnUrl property: The login URL specific to this NewRelic Organization. + * + * @return the singleSignOnUrl value. + */ + public String singleSignOnUrl() { + return this.singleSignOnUrl; + } + + /** + * Set the singleSignOnUrl property: The login URL specific to this NewRelic Organization. + * + * @param singleSignOnUrl the singleSignOnUrl value to set. + * @return the NewRelicSingleSignOnProperties object itself. + */ + public NewRelicSingleSignOnProperties withSingleSignOnUrl(String singleSignOnUrl) { + this.singleSignOnUrl = singleSignOnUrl; + return this; + } + + /** + * Get the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Provisioning state. + * + * @param provisioningState the provisioningState value to set. + * @return the NewRelicSingleSignOnProperties object itself. + */ + public NewRelicSingleSignOnProperties withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Operation.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Operation.java new file mode 100644 index 000000000000..10cab4a9f460 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Operation.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.resourcemanager.newrelic.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OperationDisplay.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OperationDisplay.java new file mode 100644 index 000000000000..c7e9ab194ee3 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OperationDisplay.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + * Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + * Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + * Machine", "Restart Virtual Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OperationListResult.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OperationListResult.java new file mode 100644 index 000000000000..7ad380bd4b44 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OperationListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.newrelic.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Operations.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Operations.java new file mode 100644 index 000000000000..1482e21d6e97 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Operations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OrgCreationSource.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OrgCreationSource.java new file mode 100644 index 000000000000..555ccaeb4bc6 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OrgCreationSource.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Source of Org creation. */ +public final class OrgCreationSource extends ExpandableStringEnum { + /** Static value LIFTR for OrgCreationSource. */ + public static final OrgCreationSource LIFTR = fromString("LIFTR"); + + /** Static value NEWRELIC for OrgCreationSource. */ + public static final OrgCreationSource NEWRELIC = fromString("NEWRELIC"); + + /** + * Creates a new instance of OrgCreationSource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OrgCreationSource() { + } + + /** + * Creates or finds a OrgCreationSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding OrgCreationSource. + */ + @JsonCreator + public static OrgCreationSource fromString(String name) { + return fromString(name, OrgCreationSource.class); + } + + /** + * Gets known OrgCreationSource values. + * + * @return known OrgCreationSource values. + */ + public static Collection values() { + return values(OrgCreationSource.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OrganizationInfo.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OrganizationInfo.java new file mode 100644 index 000000000000..c012e4261d13 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OrganizationInfo.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Organization Info of the NewRelic account. */ +@Fluent +public final class OrganizationInfo { + /* + * Organization id + */ + @JsonProperty(value = "organizationId") + private String organizationId; + + /** Creates an instance of OrganizationInfo class. */ + public OrganizationInfo() { + } + + /** + * Get the organizationId property: Organization id. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.organizationId; + } + + /** + * Set the organizationId property: Organization id. + * + * @param organizationId the organizationId value to set. + * @return the OrganizationInfo object itself. + */ + public OrganizationInfo withOrganizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OrganizationResource.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OrganizationResource.java new file mode 100644 index 000000000000..8f50b5adcf47 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OrganizationResource.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelic.fluent.models.OrganizationResourceInner; + +/** An immutable client-side representation of OrganizationResource. */ +public interface OrganizationResource { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the organizationId property: organization id. + * + * @return the organizationId value. + */ + String organizationId(); + + /** + * Gets the organizationName property: organization name. + * + * @return the organizationName value. + */ + String organizationName(); + + /** + * Gets the billingSource property: Billing source. + * + * @return the billingSource value. + */ + BillingSource billingSource(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.OrganizationResourceInner object. + * + * @return the inner object. + */ + OrganizationResourceInner innerModel(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Organizations.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Organizations.java new file mode 100644 index 000000000000..aefb68d1bc3f --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Organizations.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Organizations. */ +public interface Organizations { + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String userEmail, String location); + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String userEmail, String location, Context context); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OrganizationsListResponse.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OrganizationsListResponse.java new file mode 100644 index 000000000000..9a07f6ba1f69 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/OrganizationsListResponse.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.fluent.models.OrganizationResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of get all organizations Operation. */ +@Fluent +public final class OrganizationsListResponse { + /* + * The OrganizationResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of OrganizationsListResponse class. */ + public OrganizationsListResponse() { + } + + /** + * Get the value property: The OrganizationResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The OrganizationResource items on this page. + * + * @param value the value value to set. + * @return the OrganizationsListResponse object itself. + */ + public OrganizationsListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the OrganizationsListResponse object itself. + */ + public OrganizationsListResponse 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model OrganizationsListResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OrganizationsListResponse.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Origin.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Origin.java new file mode 100644 index 000000000000..4fd86a1e163d --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Origin.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.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/PlanData.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/PlanData.java new file mode 100644 index 000000000000..f5c52f1d7672 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/PlanData.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Plan data of NewRelic Monitor resource. */ +@Fluent +public final class PlanData { + /* + * Different usage type like PAYG/COMMITTED. this could be enum + */ + @JsonProperty(value = "usageType") + private UsageType usageType; + + /* + * Different billing cycles like MONTHLY/WEEKLY. this could be enum + */ + @JsonProperty(value = "billingCycle") + private BillingCycle billingCycle; + + /* + * plan id as published by NewRelic + */ + @JsonProperty(value = "planDetails") + private String planDetails; + + /* + * date when plan was applied + */ + @JsonProperty(value = "effectiveDate") + private OffsetDateTime effectiveDate; + + /** Creates an instance of PlanData class. */ + public PlanData() { + } + + /** + * Get the usageType property: Different usage type like PAYG/COMMITTED. this could be enum. + * + * @return the usageType value. + */ + public UsageType usageType() { + return this.usageType; + } + + /** + * Set the usageType property: Different usage type like PAYG/COMMITTED. this could be enum. + * + * @param usageType the usageType value to set. + * @return the PlanData object itself. + */ + public PlanData withUsageType(UsageType usageType) { + this.usageType = usageType; + return this; + } + + /** + * Get the billingCycle property: Different billing cycles like MONTHLY/WEEKLY. this could be enum. + * + * @return the billingCycle value. + */ + public BillingCycle billingCycle() { + return this.billingCycle; + } + + /** + * Set the billingCycle property: Different billing cycles like MONTHLY/WEEKLY. this could be enum. + * + * @param billingCycle the billingCycle value to set. + * @return the PlanData object itself. + */ + public PlanData withBillingCycle(BillingCycle billingCycle) { + this.billingCycle = billingCycle; + return this; + } + + /** + * Get the planDetails property: plan id as published by NewRelic. + * + * @return the planDetails value. + */ + public String planDetails() { + return this.planDetails; + } + + /** + * Set the planDetails property: plan id as published by NewRelic. + * + * @param planDetails the planDetails value to set. + * @return the PlanData object itself. + */ + public PlanData withPlanDetails(String planDetails) { + this.planDetails = planDetails; + return this; + } + + /** + * Get the effectiveDate property: date when plan was applied. + * + * @return the effectiveDate value. + */ + public OffsetDateTime effectiveDate() { + return this.effectiveDate; + } + + /** + * Set the effectiveDate property: date when plan was applied. + * + * @param effectiveDate the effectiveDate value to set. + * @return the PlanData object itself. + */ + public PlanData withEffectiveDate(OffsetDateTime effectiveDate) { + this.effectiveDate = effectiveDate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/PlanDataListResponse.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/PlanDataListResponse.java new file mode 100644 index 000000000000..63d24e295c8f --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/PlanDataListResponse.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.fluent.models.PlanDataResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of get all plan data Operation. */ +@Fluent +public final class PlanDataListResponse { + /* + * The PlanDataResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of PlanDataListResponse class. */ + public PlanDataListResponse() { + } + + /** + * Get the value property: The PlanDataResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The PlanDataResource items on this page. + * + * @param value the value value to set. + * @return the PlanDataListResponse object itself. + */ + public PlanDataListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the PlanDataListResponse object itself. + */ + public PlanDataListResponse 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model PlanDataListResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PlanDataListResponse.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/PlanDataResource.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/PlanDataResource.java new file mode 100644 index 000000000000..e43af2e82f49 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/PlanDataResource.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelic.fluent.models.PlanDataResourceInner; + +/** An immutable client-side representation of PlanDataResource. */ +public interface PlanDataResource { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the planData property: Plan details. + * + * @return the planData value. + */ + PlanData planData(); + + /** + * Gets the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + OrgCreationSource orgCreationSource(); + + /** + * Gets the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + AccountCreationSource accountCreationSource(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.PlanDataResourceInner object. + * + * @return the inner object. + */ + PlanDataResourceInner innerModel(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Plans.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Plans.java new file mode 100644 index 000000000000..6c3ddbdd60fd --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/Plans.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Plans. */ +public interface Plans { + /** + * List plans data. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization 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 response of get all plan data Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String accountId, String organizationId, Context context); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/ProvisioningState.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/ProvisioningState.java new file mode 100644 index 000000000000..83c2df7ddc49 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/ProvisioningState.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Provisioning State of the Monitor resource. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Accepted for ProvisioningState. */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Deleted for ProvisioningState. */ + public static final ProvisioningState DELETED = fromString("Deleted"); + + /** Static value NotSpecified for ProvisioningState. */ + public static final ProvisioningState NOT_SPECIFIED = fromString("NotSpecified"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendAadLogsStatus.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendAadLogsStatus.java new file mode 100644 index 000000000000..97a4d7b766e4 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendAadLogsStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether AAD logs are being sent. */ +public final class SendAadLogsStatus extends ExpandableStringEnum { + /** Static value Enabled for SendAadLogsStatus. */ + public static final SendAadLogsStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for SendAadLogsStatus. */ + public static final SendAadLogsStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of SendAadLogsStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SendAadLogsStatus() { + } + + /** + * Creates or finds a SendAadLogsStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SendAadLogsStatus. + */ + @JsonCreator + public static SendAadLogsStatus fromString(String name) { + return fromString(name, SendAadLogsStatus.class); + } + + /** + * Gets known SendAadLogsStatus values. + * + * @return known SendAadLogsStatus values. + */ + public static Collection values() { + return values(SendAadLogsStatus.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendActivityLogsStatus.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendActivityLogsStatus.java new file mode 100644 index 000000000000..cabd7c79da96 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendActivityLogsStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether activity logs are being sent. */ +public final class SendActivityLogsStatus extends ExpandableStringEnum { + /** Static value Enabled for SendActivityLogsStatus. */ + public static final SendActivityLogsStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for SendActivityLogsStatus. */ + public static final SendActivityLogsStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of SendActivityLogsStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SendActivityLogsStatus() { + } + + /** + * Creates or finds a SendActivityLogsStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SendActivityLogsStatus. + */ + @JsonCreator + public static SendActivityLogsStatus fromString(String name) { + return fromString(name, SendActivityLogsStatus.class); + } + + /** + * Gets known SendActivityLogsStatus values. + * + * @return known SendActivityLogsStatus values. + */ + public static Collection values() { + return values(SendActivityLogsStatus.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendMetricsStatus.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendMetricsStatus.java new file mode 100644 index 000000000000..e2c9b3464dff --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendMetricsStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether metrics are being sent. */ +public final class SendMetricsStatus extends ExpandableStringEnum { + /** Static value Enabled for SendMetricsStatus. */ + public static final SendMetricsStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for SendMetricsStatus. */ + public static final SendMetricsStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of SendMetricsStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SendMetricsStatus() { + } + + /** + * Creates or finds a SendMetricsStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SendMetricsStatus. + */ + @JsonCreator + public static SendMetricsStatus fromString(String name) { + return fromString(name, SendMetricsStatus.class); + } + + /** + * Gets known SendMetricsStatus values. + * + * @return known SendMetricsStatus values. + */ + public static Collection values() { + return values(SendMetricsStatus.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendSubscriptionLogsStatus.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendSubscriptionLogsStatus.java new file mode 100644 index 000000000000..76fd72f8c676 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendSubscriptionLogsStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether subscription logs are being sent. */ +public final class SendSubscriptionLogsStatus extends ExpandableStringEnum { + /** Static value Enabled for SendSubscriptionLogsStatus. */ + public static final SendSubscriptionLogsStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for SendSubscriptionLogsStatus. */ + public static final SendSubscriptionLogsStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of SendSubscriptionLogsStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SendSubscriptionLogsStatus() { + } + + /** + * Creates or finds a SendSubscriptionLogsStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SendSubscriptionLogsStatus. + */ + @JsonCreator + public static SendSubscriptionLogsStatus fromString(String name) { + return fromString(name, SendSubscriptionLogsStatus.class); + } + + /** + * Gets known SendSubscriptionLogsStatus values. + * + * @return known SendSubscriptionLogsStatus values. + */ + public static Collection values() { + return values(SendSubscriptionLogsStatus.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendingLogsStatus.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendingLogsStatus.java new file mode 100644 index 000000000000..0d320180e3fd --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendingLogsStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether logs are being sent. */ +public final class SendingLogsStatus extends ExpandableStringEnum { + /** Static value Enabled for SendingLogsStatus. */ + public static final SendingLogsStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for SendingLogsStatus. */ + public static final SendingLogsStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of SendingLogsStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SendingLogsStatus() { + } + + /** + * Creates or finds a SendingLogsStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SendingLogsStatus. + */ + @JsonCreator + public static SendingLogsStatus fromString(String name) { + return fromString(name, SendingLogsStatus.class); + } + + /** + * Gets known SendingLogsStatus values. + * + * @return known SendingLogsStatus values. + */ + public static Collection values() { + return values(SendingLogsStatus.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendingMetricsStatus.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendingMetricsStatus.java new file mode 100644 index 000000000000..05332d985d4b --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SendingMetricsStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether metrics are being sent. */ +public final class SendingMetricsStatus extends ExpandableStringEnum { + /** Static value Enabled for SendingMetricsStatus. */ + public static final SendingMetricsStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for SendingMetricsStatus. */ + public static final SendingMetricsStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of SendingMetricsStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SendingMetricsStatus() { + } + + /** + * Creates or finds a SendingMetricsStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SendingMetricsStatus. + */ + @JsonCreator + public static SendingMetricsStatus fromString(String name) { + return fromString(name, SendingMetricsStatus.class); + } + + /** + * Gets known SendingMetricsStatus values. + * + * @return known SendingMetricsStatus values. + */ + public static Collection values() { + return values(SendingMetricsStatus.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SingleSignOnStates.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SingleSignOnStates.java new file mode 100644 index 000000000000..5545e0be937e --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SingleSignOnStates.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.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Various states of the SSO resource. */ +public final class SingleSignOnStates extends ExpandableStringEnum { + /** Static value Initial for SingleSignOnStates. */ + public static final SingleSignOnStates INITIAL = fromString("Initial"); + + /** Static value Enable for SingleSignOnStates. */ + public static final SingleSignOnStates ENABLE = fromString("Enable"); + + /** Static value Disable for SingleSignOnStates. */ + public static final SingleSignOnStates DISABLE = fromString("Disable"); + + /** Static value Existing for SingleSignOnStates. */ + public static final SingleSignOnStates EXISTING = fromString("Existing"); + + /** + * Creates a new instance of SingleSignOnStates value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SingleSignOnStates() { + } + + /** + * Creates or finds a SingleSignOnStates from its string representation. + * + * @param name a name to look for. + * @return the corresponding SingleSignOnStates. + */ + @JsonCreator + public static SingleSignOnStates fromString(String name) { + return fromString(name, SingleSignOnStates.class); + } + + /** + * Gets known SingleSignOnStates values. + * + * @return known SingleSignOnStates values. + */ + public static Collection values() { + return values(SingleSignOnStates.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SwitchBillingRequest.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SwitchBillingRequest.java new file mode 100644 index 000000000000..b5400c89b858 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/SwitchBillingRequest.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request of a switch billing Operation. */ +@Fluent +public final class SwitchBillingRequest { + /* + * Azure resource Id + */ + @JsonProperty(value = "azureResourceId") + private String azureResourceId; + + /* + * Organization id + */ + @JsonProperty(value = "organizationId") + private String organizationId; + + /* + * Plan details + */ + @JsonProperty(value = "planData") + private PlanData planData; + + /* + * User Email + */ + @JsonProperty(value = "userEmail", required = true) + private String userEmail; + + /** Creates an instance of SwitchBillingRequest class. */ + public SwitchBillingRequest() { + } + + /** + * Get the azureResourceId property: Azure resource Id. + * + * @return the azureResourceId value. + */ + public String azureResourceId() { + return this.azureResourceId; + } + + /** + * Set the azureResourceId property: Azure resource Id. + * + * @param azureResourceId the azureResourceId value to set. + * @return the SwitchBillingRequest object itself. + */ + public SwitchBillingRequest withAzureResourceId(String azureResourceId) { + this.azureResourceId = azureResourceId; + return this; + } + + /** + * Get the organizationId property: Organization id. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.organizationId; + } + + /** + * Set the organizationId property: Organization id. + * + * @param organizationId the organizationId value to set. + * @return the SwitchBillingRequest object itself. + */ + public SwitchBillingRequest withOrganizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.planData; + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the SwitchBillingRequest object itself. + */ + public SwitchBillingRequest withPlanData(PlanData planData) { + this.planData = planData; + return this; + } + + /** + * Get the userEmail property: User Email. + * + * @return the userEmail value. + */ + public String userEmail() { + return this.userEmail; + } + + /** + * Set the userEmail property: User Email. + * + * @param userEmail the userEmail value to set. + * @return the SwitchBillingRequest object itself. + */ + public SwitchBillingRequest withUserEmail(String userEmail) { + this.userEmail = userEmail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (planData() != null) { + planData().validate(); + } + if (userEmail() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property userEmail in model SwitchBillingRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SwitchBillingRequest.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagAction.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagAction.java new file mode 100644 index 000000000000..de42d95d6983 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagAction.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Valid actions for a filtering tag. Exclusion takes priority over inclusion. */ +public final class TagAction extends ExpandableStringEnum { + /** Static value Include for TagAction. */ + public static final TagAction INCLUDE = fromString("Include"); + + /** Static value Exclude for TagAction. */ + public static final TagAction EXCLUDE = fromString("Exclude"); + + /** + * Creates a new instance of TagAction value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TagAction() { + } + + /** + * Creates or finds a TagAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding TagAction. + */ + @JsonCreator + public static TagAction fromString(String name) { + return fromString(name, TagAction.class); + } + + /** + * Gets known TagAction values. + * + * @return known TagAction values. + */ + public static Collection values() { + return values(TagAction.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRule.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRule.java new file mode 100644 index 000000000000..3850eead6b8c --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRule.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelic.fluent.models.TagRuleInner; + +/** An immutable client-side representation of TagRule. */ +public interface TagRule { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + LogRules logRules(); + + /** + * Gets the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + MetricRules metricRules(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.TagRuleInner object. + * + * @return the inner object. + */ + TagRuleInner innerModel(); + + /** The entirety of the TagRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The TagRule definition stages. */ + interface DefinitionStages { + /** The first stage of the TagRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the TagRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, monitorName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @return the next definition stage. + */ + WithCreate withExistingMonitor(String resourceGroupName, String monitorName); + } + /** + * The stage of the TagRule definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithLogRules, DefinitionStages.WithMetricRules { + /** + * Executes the create request. + * + * @return the created resource. + */ + TagRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + TagRule create(Context context); + } + /** The stage of the TagRule definition allowing to specify logRules. */ + interface WithLogRules { + /** + * Specifies the logRules property: Set of rules for sending logs for the Monitor resource.. + * + * @param logRules Set of rules for sending logs for the Monitor resource. + * @return the next definition stage. + */ + WithCreate withLogRules(LogRules logRules); + } + /** The stage of the TagRule definition allowing to specify metricRules. */ + interface WithMetricRules { + /** + * Specifies the metricRules property: Set of rules for sending metrics for the Monitor resource.. + * + * @param metricRules Set of rules for sending metrics for the Monitor resource. + * @return the next definition stage. + */ + WithCreate withMetricRules(MetricRulesInner metricRules); + } + } + /** + * Begins update for the TagRule resource. + * + * @return the stage of resource update. + */ + TagRule.Update update(); + + /** The template for TagRule update. */ + interface Update extends UpdateStages.WithLogRules, UpdateStages.WithMetricRules { + /** + * Executes the update request. + * + * @return the updated resource. + */ + TagRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + TagRule apply(Context context); + } + /** The TagRule update stages. */ + interface UpdateStages { + /** The stage of the TagRule update allowing to specify logRules. */ + interface WithLogRules { + /** + * Specifies the logRules property: Set of rules for sending logs for the Monitor resource.. + * + * @param logRules Set of rules for sending logs for the Monitor resource. + * @return the next definition stage. + */ + Update withLogRules(LogRules logRules); + } + /** The stage of the TagRule update allowing to specify metricRules. */ + interface WithMetricRules { + /** + * Specifies the metricRules property: Set of rules for sending metrics for the Monitor resource.. + * + * @param metricRules Set of rules for sending metrics for the Monitor resource. + * @return the next definition stage. + */ + Update withMetricRules(MetricRulesInner metricRules); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + TagRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + TagRule refresh(Context context); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRuleListResult.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRuleListResult.java new file mode 100644 index 000000000000..af458b92f171 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRuleListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.fluent.models.TagRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a TagRule list operation. */ +@Fluent +public final class TagRuleListResult { + /* + * The TagRule items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of TagRuleListResult class. */ + public TagRuleListResult() { + } + + /** + * Get the value property: The TagRule items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The TagRule items on this page. + * + * @param value the value value to set. + * @return the TagRuleListResult object itself. + */ + public TagRuleListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the TagRuleListResult object itself. + */ + public TagRuleListResult 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model TagRuleListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TagRuleListResult.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRuleUpdate.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRuleUpdate.java new file mode 100644 index 000000000000..93380f618da5 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRuleUpdate.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.resourcemanager.newrelic.fluent.models.TagRuleUpdateInner; + +/** An immutable client-side representation of TagRuleUpdate. */ +public interface TagRuleUpdate { + /** + * Gets the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + LogRules logRules(); + + /** + * Gets the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + MetricRules metricRules(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.TagRuleUpdateInner object. + * + * @return the inner object. + */ + TagRuleUpdateInner innerModel(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRuleUpdateProperties.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRuleUpdateProperties.java new file mode 100644 index 000000000000..ab629292b50d --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRuleUpdateProperties.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.resourcemanager.newrelic.fluent.models.TagRuleUpdatePropertiesInner; + +/** An immutable client-side representation of TagRuleUpdateProperties. */ +public interface TagRuleUpdateProperties { + /** + * Gets the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + LogRules logRules(); + + /** + * Gets the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + MetricRules metricRules(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.TagRuleUpdatePropertiesInner object. + * + * @return the inner object. + */ + TagRuleUpdatePropertiesInner innerModel(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRules.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRules.java new file mode 100644 index 000000000000..2681f29c8a64 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/TagRules.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TagRules. */ +public interface TagRules { + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByNewRelicMonitorResource(String resourceGroupName, String monitorName); + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByNewRelicMonitorResource(String resourceGroupName, String monitorName, Context context); + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context); + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule. + */ + TagRule get(String resourceGroupName, String monitorName, String ruleSetName); + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String monitorName, String ruleSetName); + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String monitorName, String ruleSetName, Context context); + + /** + * Get a TagRule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response}. + */ + TagRule getById(String id); + + /** + * Get a TagRule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a TagRule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a TagRule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new TagRule resource. + * + * @param name resource name. + * @return the first stage of the new TagRule definition. + */ + TagRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/UsageType.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/UsageType.java new file mode 100644 index 000000000000..1a58a1472201 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/UsageType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Different usage type like PAYG/COMMITTED. */ +public final class UsageType extends ExpandableStringEnum { + /** Static value PAYG for UsageType. */ + public static final UsageType PAYG = fromString("PAYG"); + + /** Static value COMMITTED for UsageType. */ + public static final UsageType COMMITTED = fromString("COMMITTED"); + + /** + * Creates a new instance of UsageType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public UsageType() { + } + + /** + * Creates or finds a UsageType from its string representation. + * + * @param name a name to look for. + * @return the corresponding UsageType. + */ + @JsonCreator + public static UsageType fromString(String name) { + return fromString(name, UsageType.class); + } + + /** + * Gets known UsageType values. + * + * @return known UsageType values. + */ + public static Collection values() { + return values(UsageType.class); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/UserAssignedIdentity.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..7de6c6253b26 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/UserAssignedIdentity.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** User assigned identity properties. */ +@Immutable +public class UserAssignedIdentity { + /* + * The principal ID of the assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** Creates an instance of UserAssignedIdentity class. */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/UserInfo.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/UserInfo.java new file mode 100644 index 000000000000..1e003ba18a30 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/UserInfo.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** User Info of NewRelic Monitor resource. */ +@Fluent +public final class UserInfo { + /* + * First name + */ + @JsonProperty(value = "firstName") + private String firstName; + + /* + * Last name + */ + @JsonProperty(value = "lastName") + private String lastName; + + /* + * User Email + */ + @JsonProperty(value = "emailAddress") + private String emailAddress; + + /* + * Contact phone number + */ + @JsonProperty(value = "phoneNumber") + private String phoneNumber; + + /* + * country if user + */ + @JsonProperty(value = "country") + private String country; + + /** Creates an instance of UserInfo class. */ + public UserInfo() { + } + + /** + * Get the firstName property: First name. + * + * @return the firstName value. + */ + public String firstName() { + return this.firstName; + } + + /** + * Set the firstName property: First name. + * + * @param firstName the firstName value to set. + * @return the UserInfo object itself. + */ + public UserInfo withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get the lastName property: Last name. + * + * @return the lastName value. + */ + public String lastName() { + return this.lastName; + } + + /** + * Set the lastName property: Last name. + * + * @param lastName the lastName value to set. + * @return the UserInfo object itself. + */ + public UserInfo withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get the emailAddress property: User Email. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the emailAddress property: User Email. + * + * @param emailAddress the emailAddress value to set. + * @return the UserInfo object itself. + */ + public UserInfo withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the phoneNumber property: Contact phone number. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: Contact phone number. + * + * @param phoneNumber the phoneNumber value to set. + * @return the UserInfo object itself. + */ + public UserInfo withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the country property: country if user. + * + * @return the country value. + */ + public String country() { + return this.country; + } + + /** + * Set the country property: country if user. + * + * @param country the country value to set. + * @return the UserInfo object itself. + */ + public UserInfo withCountry(String country) { + this.country = country; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/VMExtensionPayload.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/VMExtensionPayload.java new file mode 100644 index 000000000000..b481af167232 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/VMExtensionPayload.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.resourcemanager.newrelic.fluent.models.VMExtensionPayloadInner; + +/** An immutable client-side representation of VMExtensionPayload. */ +public interface VMExtensionPayload { + /** + * Gets the ingestionKey property: Ingestion key of the account. + * + * @return the ingestionKey value. + */ + String ingestionKey(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.VMExtensionPayloadInner object. + * + * @return the inner object. + */ + VMExtensionPayloadInner innerModel(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/VMHostsListResponse.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/VMHostsListResponse.java new file mode 100644 index 000000000000..0185e402fdbd --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/VMHostsListResponse.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelic.fluent.models.VMInfoInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of a list VM Host Operation. */ +@Fluent +public final class VMHostsListResponse { + /* + * The VMInfo items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of VMHostsListResponse class. */ + public VMHostsListResponse() { + } + + /** + * Get the value property: The VMInfo items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The VMInfo items on this page. + * + * @param value the value value to set. + * @return the VMHostsListResponse object itself. + */ + public VMHostsListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the VMHostsListResponse object itself. + */ + public VMHostsListResponse 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model VMHostsListResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VMHostsListResponse.class); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/VMInfo.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/VMInfo.java new file mode 100644 index 000000000000..b05dce80ed0f --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/VMInfo.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.models; + +import com.azure.resourcemanager.newrelic.fluent.models.VMInfoInner; + +/** An immutable client-side representation of VMInfo. */ +public interface VMInfo { + /** + * Gets the vmId property: Azure VM resource ID. + * + * @return the vmId value. + */ + String vmId(); + + /** + * Gets the agentVersion property: Version of the NewRelic agent installed on the VM. + * + * @return the agentVersion value. + */ + String agentVersion(); + + /** + * Gets the agentStatus property: Status of the NewRelic agent installed on the VM. + * + * @return the agentStatus value. + */ + String agentStatus(); + + /** + * Gets the inner com.azure.resourcemanager.newrelic.fluent.models.VMInfoInner object. + * + * @return the inner object. + */ + VMInfoInner innerModel(); +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/package-info.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/models/package-info.java new file mode 100644 index 000000000000..dc79b6cd800b --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/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 NewRelicObservability. null. */ +package com.azure.resourcemanager.newrelic.models; diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/package-info.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/package-info.java new file mode 100644 index 000000000000..89e759c4fbf0 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/com/azure/resourcemanager/newrelic/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 NewRelicObservability. null. */ +package com.azure.resourcemanager.newrelic; diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/module-info.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/main/java/module-info.java new file mode 100644 index 000000000000..dca094bb0747 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/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.newrelic { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.newrelic; + exports com.azure.resourcemanager.newrelic.fluent; + exports com.azure.resourcemanager.newrelic.fluent.models; + exports com.azure.resourcemanager.newrelic.models; + + opens com.azure.resourcemanager.newrelic.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.newrelic.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/AccountsListSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/AccountsListSamples.java new file mode 100644 index 000000000000..e42d3b68745b --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/AccountsListSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +/** Samples for Accounts List. */ +public final class AccountsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MinimumSet_Gen.json + */ + /** + * Sample code: Accounts_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void accountsListMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.accounts().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MaximumSet_Gen.json + */ + /** + * Sample code: Accounts_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void accountsListMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.accounts().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsCreateOrUpdateSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..82ff3aa525aa --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsCreateOrUpdateSamples.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +import com.azure.resourcemanager.newrelic.models.AccountCreationSource; +import com.azure.resourcemanager.newrelic.models.AccountInfo; +import com.azure.resourcemanager.newrelic.models.BillingCycle; +import com.azure.resourcemanager.newrelic.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelic.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelic.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelic.models.NewRelicSingleSignOnProperties; +import com.azure.resourcemanager.newrelic.models.OrgCreationSource; +import com.azure.resourcemanager.newrelic.models.OrganizationInfo; +import com.azure.resourcemanager.newrelic.models.PlanData; +import com.azure.resourcemanager.newrelic.models.ProvisioningState; +import com.azure.resourcemanager.newrelic.models.SingleSignOnStates; +import com.azure.resourcemanager.newrelic.models.UsageType; +import com.azure.resourcemanager.newrelic.models.UserAssignedIdentity; +import com.azure.resourcemanager.newrelic.models.UserInfo; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Monitors CreateOrUpdate. */ +public final class MonitorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsCreateOrUpdateMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .define("cdlymktqw") + .withRegion("k") + .withExistingResourceGroup("rgNewRelic") + .withTags(mapOf("key6976", "oaxfhf")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("key8903", new UserAssignedIdentity()))) + .withNewRelicAccountProperties( + new NewRelicAccountProperties() + .withUserId("vcscxlncofcuduadesd") + .withAccountInfo( + new AccountInfo() + .withAccountId("xhqmg") + .withIngestionKey("fakeTokenPlaceholder") + .withRegion("ljcf")) + .withOrganizationInfo(new OrganizationInfo().withOrganizationId("k")) + .withSingleSignOnProperties( + new NewRelicSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.INITIAL) + .withEnterpriseAppId("kwiwfz") + .withSingleSignOnUrl("kvseueuljsxmfwpqctz") + .withProvisioningState(ProvisioningState.ACCEPTED))) + .withUserInfo( + new UserInfo() + .withFirstName("vdftzcggirefejajwahhwhyibutramdaotvnuf") + .withLastName("bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc") + .withEmailAddress("%6%@4-g.N1.3F-kI1.Ue-.lJso") + .withPhoneNumber("krf") + .withCountry("hslqnwdanrconqyekwbnttaetv")) + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("tbbiaga") + .withEffectiveDate(OffsetDateTime.parse("2022-12-05T14:11:37.786Z"))) + .withOrgCreationSource(OrgCreationSource.LIFTR) + .withAccountCreationSource(AccountCreationSource.LIFTR) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsDeleteSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsDeleteSamples.java new file mode 100644 index 000000000000..f778ad9aeb71 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsDeleteSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +/** Samples for Monitors Delete. */ +public final class MonitorsDeleteSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_Delete_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsDeleteMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.monitors().delete("rgopenapi", null, "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_Delete_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsDeleteMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .delete( + "rgopenapi", + "ruxvg@xqkmdhrnoo.hlmbpm", + "ipxmlcbonyxtolzejcjshkmlron", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsGetByResourceGroupSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..8f82daa03816 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsGetByResourceGroupSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +/** Samples for Monitors GetByResourceGroup. */ +public final class MonitorsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_Get_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsGetMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.monitors().getByResourceGroupWithResponse("rgNewRelic", "cdlymktqw", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsGetMetricRulesSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsGetMetricRulesSamples.java new file mode 100644 index 000000000000..1d9d1a51bd02 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsGetMetricRulesSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +import com.azure.resourcemanager.newrelic.models.MetricsRequest; + +/** Samples for Monitors GetMetricRules. */ +public final class MonitorsGetMetricRulesSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricRules_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsGetMetricRulesMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .getMetricRulesWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricRules_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsGetMetricRulesMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .getMetricRulesWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsGetMetricStatusSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsGetMetricStatusSamples.java new file mode 100644 index 000000000000..d189f3a088fb --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsGetMetricStatusSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +import com.azure.resourcemanager.newrelic.models.MetricsStatusRequest; +import java.util.Arrays; + +/** Samples for Monitors GetMetricStatus. */ +public final class MonitorsGetMetricStatusSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricStatus_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsGetMetricStatusMinimumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .getMetricStatusWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsStatusRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricStatus_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsGetMetricStatusMaximumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .getMetricStatusWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsStatusRequest() + .withAzureResourceIds(Arrays.asList("enfghpfw")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListAppServicesSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListAppServicesSamples.java new file mode 100644 index 000000000000..db4c4e6d1911 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListAppServicesSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +import com.azure.resourcemanager.newrelic.models.AppServicesGetRequest; +import java.util.Arrays; + +/** Samples for Monitors ListAppServices. */ +public final class MonitorsListAppServicesSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListAppServices_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListAppServicesMaximumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .listAppServices( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new AppServicesGetRequest() + .withAzureResourceIds(Arrays.asList("pvzrksrmzowobuhxpwiotnpcvjbu")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_ListAppServices_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListAppServicesMinimumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .listAppServices( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new AppServicesGetRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListByResourceGroupSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListByResourceGroupSamples.java new file mode 100644 index 000000000000..5a3b1fd9be64 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +/** Samples for Monitors ListByResourceGroup. */ +public final class MonitorsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListByResourceGroup_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListByResourceGroupMaximumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.monitors().listByResourceGroup("rgNewRelic", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListHostsSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListHostsSamples.java new file mode 100644 index 000000000000..730b37542854 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListHostsSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +import com.azure.resourcemanager.newrelic.models.HostsGetRequest; +import java.util.Arrays; + +/** Samples for Monitors ListHosts. */ +public final class MonitorsListHostsSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_ListHosts_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListHostsMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .listHosts( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + new HostsGetRequest() + .withVmIds(Arrays.asList("xzphvxvfmvjrnsgyns")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListHosts_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListHostsMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .listHosts( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + new HostsGetRequest() + .withVmIds(Arrays.asList("xzphvxvfmvjrnsgyns")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListMonitoredResourcesSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListMonitoredResourcesSamples.java new file mode 100644 index 000000000000..5935a35c931e --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListMonitoredResourcesSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +/** Samples for Monitors ListMonitoredResources. */ +public final class MonitorsListMonitoredResourcesSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_ListMonitoredResources_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListMonitoredResourcesMinimumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .listMonitoredResources("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListMonitoredResources_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListMonitoredResourcesMaximumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .listMonitoredResources("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListSamples.java new file mode 100644 index 000000000000..26ee263538e4 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +/** Samples for Monitors List. */ +public final class MonitorsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListBySubscription_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsListBySubscriptionMaximumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.monitors().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsSwitchBillingSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsSwitchBillingSamples.java new file mode 100644 index 000000000000..31f599126745 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsSwitchBillingSamples.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +import com.azure.resourcemanager.newrelic.models.BillingCycle; +import com.azure.resourcemanager.newrelic.models.PlanData; +import com.azure.resourcemanager.newrelic.models.SwitchBillingRequest; +import com.azure.resourcemanager.newrelic.models.UsageType; +import java.time.OffsetDateTime; + +/** Samples for Monitors SwitchBilling. */ +public final class MonitorsSwitchBillingSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_SwitchBilling_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsSwitchBillingMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .switchBillingWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new SwitchBillingRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_SwitchBilling_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsSwitchBillingMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .switchBillingWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new SwitchBillingRequest() + .withAzureResourceId("enfghpfw") + .withOrganizationId("k") + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("tbbiaga") + .withEffectiveDate(OffsetDateTime.parse("2022-12-05T14:11:37.786Z"))) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsUpdateSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsUpdateSamples.java new file mode 100644 index 000000000000..77371aadee56 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsUpdateSamples.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.newrelic.generated; + +import com.azure.resourcemanager.newrelic.models.AccountCreationSource; +import com.azure.resourcemanager.newrelic.models.AccountInfo; +import com.azure.resourcemanager.newrelic.models.BillingCycle; +import com.azure.resourcemanager.newrelic.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelic.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelic.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelic.models.NewRelicMonitorResource; +import com.azure.resourcemanager.newrelic.models.NewRelicSingleSignOnProperties; +import com.azure.resourcemanager.newrelic.models.OrgCreationSource; +import com.azure.resourcemanager.newrelic.models.OrganizationInfo; +import com.azure.resourcemanager.newrelic.models.PlanData; +import com.azure.resourcemanager.newrelic.models.ProvisioningState; +import com.azure.resourcemanager.newrelic.models.SingleSignOnStates; +import com.azure.resourcemanager.newrelic.models.UsageType; +import com.azure.resourcemanager.newrelic.models.UserAssignedIdentity; +import com.azure.resourcemanager.newrelic.models.UserInfo; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Monitors Update. */ +public final class MonitorsUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_Update_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsUpdateMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + NewRelicMonitorResource resource = + manager + .monitors() + .getByResourceGroupWithResponse("rgNewRelic", "cdlymktqw", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key164", "jqakdrrmmyzytqu")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("key8903", new UserAssignedIdentity()))) + .withNewRelicAccountProperties( + new NewRelicAccountProperties() + .withUserId("vcscxlncofcuduadesd") + .withAccountInfo( + new AccountInfo() + .withAccountId("xhqmg") + .withIngestionKey("fakeTokenPlaceholder") + .withRegion("ljcf")) + .withOrganizationInfo(new OrganizationInfo().withOrganizationId("k")) + .withSingleSignOnProperties( + new NewRelicSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.INITIAL) + .withEnterpriseAppId("kwiwfz") + .withSingleSignOnUrl("kvseueuljsxmfwpqctz") + .withProvisioningState(ProvisioningState.ACCEPTED))) + .withUserInfo( + new UserInfo() + .withFirstName("vdftzcggirefejajwahhwhyibutramdaotvnuf") + .withLastName("bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc") + .withEmailAddress("%6%@4-g.N1.3F-kI1.Ue-.lJso") + .withPhoneNumber("krf") + .withCountry("hslqnwdanrconqyekwbnttaetv")) + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("tbbiaga") + .withEffectiveDate(OffsetDateTime.parse("2022-12-05T14:11:37.786Z"))) + .withOrgCreationSource(OrgCreationSource.LIFTR) + .withAccountCreationSource(AccountCreationSource.LIFTR) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsVmHostPayloadSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsVmHostPayloadSamples.java new file mode 100644 index 000000000000..a541f13caa2f --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/MonitorsVmHostPayloadSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +/** Samples for Monitors VmHostPayload. */ +public final class MonitorsVmHostPayloadSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_VmHostPayload_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsVmHostPayloadMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .vmHostPayloadWithResponse("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_VmHostPayload_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void monitorsVmHostPayloadMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .monitors() + .vmHostPayloadWithResponse("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/OperationsListSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/OperationsListSamples.java new file mode 100644 index 000000000000..4ca91e3c7951 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/OperationsListSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void operationsListMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void operationsListMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/OrganizationsListSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/OrganizationsListSamples.java new file mode 100644 index 000000000000..d4c69abec9ef --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/OrganizationsListSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +/** Samples for Organizations List. */ +public final class OrganizationsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Organizations_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void organizationsListMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.organizations().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void organizationsListMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.organizations().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/PlansListSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/PlansListSamples.java new file mode 100644 index 000000000000..68f119e431d7 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/PlansListSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +/** Samples for Plans List. */ +public final class PlansListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MaximumSet_Gen.json + */ + /** + * Sample code: Plans_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void plansListMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.plans().list("pwuxgvrmkk", "hilawwjz", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MinimumSet_Gen.json + */ + /** + * Sample code: Plans_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void plansListMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager.plans().list(null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesCreateOrUpdateSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..4498d81b740c --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesCreateOrUpdateSamples.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelic.models.FilteringTag; +import com.azure.resourcemanager.newrelic.models.LogRules; +import com.azure.resourcemanager.newrelic.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelic.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelic.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelic.models.TagAction; +import java.util.Arrays; + +/** Samples for TagRules CreateOrUpdate. */ +public final class TagRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesCreateOrUpdateMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .define("bxcantgzggsepbhqmedjqyrqeezmfb") + .withExistingMonitor("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron") + .withLogRules( + new LogRules() + .withSendAadLogs(SendAadLogsStatus.ENABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.ENABLED) + .withSendActivityLogs(SendActivityLogsStatus.ENABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE)))) + .withMetricRules( + new MetricRulesInner() + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE))) + .withUserEmail("test@testing.com")) + .create(); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_CreateOrUpdate_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesCreateOrUpdateMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .define("bxcantgzggsepbhqmedjqyrqeezmfb") + .withExistingMonitor("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron") + .create(); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesDeleteSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesDeleteSamples.java new file mode 100644 index 000000000000..af0a269f88a9 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesDeleteSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +/** Samples for TagRules Delete. */ +public final class TagRulesDeleteSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_Delete_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesDeleteMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .delete( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_Delete_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesDeleteMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .delete( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesGetSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesGetSamples.java new file mode 100644 index 000000000000..ec8e7b621eb8 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesGetSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +/** Samples for TagRules Get. */ +public final class TagRulesGetSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_Get_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesGetMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_Get_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesGetMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesListByNewRelicMonitorResourceSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesListByNewRelicMonitorResourceSamples.java new file mode 100644 index 000000000000..3ff8f2bb88eb --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesListByNewRelicMonitorResourceSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelic.generated; + +/** Samples for TagRules ListByNewRelicMonitorResource. */ +public final class TagRulesListByNewRelicMonitorResourceSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_ListByNewRelicMonitorResource_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesListByNewRelicMonitorResourceMinimumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .listByNewRelicMonitorResource( + "rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_ListByNewRelicMonitorResource_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesListByNewRelicMonitorResourceMaximumSetGen( + com.azure.resourcemanager.newrelic.NewRelicManager manager) { + manager + .tagRules() + .listByNewRelicMonitorResource( + "rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesUpdateSamples.java b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesUpdateSamples.java new file mode 100644 index 000000000000..48e43aea47e1 --- /dev/null +++ b/sdk/newrelic/azure-resourcemanager-newrelic/src/samples/java/com/azure/resourcemanager/newrelic/generated/TagRulesUpdateSamples.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.newrelic.generated; + +import com.azure.resourcemanager.newrelic.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelic.models.FilteringTag; +import com.azure.resourcemanager.newrelic.models.LogRules; +import com.azure.resourcemanager.newrelic.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelic.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelic.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelic.models.TagAction; +import com.azure.resourcemanager.newrelic.models.TagRule; +import java.util.Arrays; + +/** Samples for TagRules Update. */ +public final class TagRulesUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_Update_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesUpdateMaximumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + TagRule resource = + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withLogRules( + new LogRules() + .withSendAadLogs(SendAadLogsStatus.ENABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.ENABLED) + .withSendActivityLogs(SendActivityLogsStatus.ENABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE)))) + .withMetricRules( + new MetricRulesInner() + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE))) + .withUserEmail("test@testing.com")) + .apply(); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_Update_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicManager. + */ + public static void tagRulesUpdateMinimumSetGen(com.azure.resourcemanager.newrelic.NewRelicManager manager) { + TagRule resource = + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/newrelic/ci.yml b/sdk/newrelic/ci.yml new file mode 100644 index 000000000000..8f1d8d0b5940 --- /dev/null +++ b/sdk/newrelic/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/newrelic/ci.yml + - sdk/newrelic/azure-resourcemanager-newrelic/ + exclude: + - sdk/newrelic/pom.xml + - sdk/newrelic/azure-resourcemanager-newrelic/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/newrelic/ci.yml + - sdk/newrelic/azure-resourcemanager-newrelic/ + exclude: + - sdk/newrelic/pom.xml + - sdk/newrelic/azure-resourcemanager-newrelic/pom.xml + +parameters: + - name: release_azureresourcemanagernewrelic + displayName: azure-resourcemanager-newrelic + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: newrelic + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-newrelic + groupId: com.azure.resourcemanager + safeName: azureresourcemanagernewrelic + releaseInBatch: ${{ parameters.release_azureresourcemanagernewrelic }} diff --git a/sdk/newrelic/pom.xml b/sdk/newrelic/pom.xml new file mode 100644 index 000000000000..6d52946399a1 --- /dev/null +++ b/sdk/newrelic/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-newrelic-service + pom + 1.0.0 + + + azure-resourcemanager-newrelic + +