From 421fba17919bb27557e95a1c7bb09f1843385214 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sun, 15 May 2022 10:53:33 +0000 Subject: [PATCH] CodeGen from PR 18820 in Azure/azure-rest-api-specs AMS v2 public preview (#18820) * Adding monitors spec and examples Adding monitors spec and examples * All Monitors spec and examples All Monitors spec and examples * Delete commonTypes.json * Added new providers Added new providers * Updating with recent monitors spec changes in private repo Updating with recent monitors spec changes in private repo * Changes for Go sdk Changes for Go sdk * Update readme.md --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../azure-resourcemanager-workloads/README.md | 102 ++ .../azure-resourcemanager-workloads/SAMPLE.md | 534 ++++++ .../azure-resourcemanager-workloads/pom.xml | 55 + .../workloads/WorkloadsManager.java | 314 ++++ .../workloads/fluent/MonitorsClient.java | 245 +++ .../workloads/fluent/OperationsClient.java | 38 + .../fluent/ProviderInstancesClient.java | 224 +++ .../workloads/fluent/WorkloadsClient.java | 67 + .../workloads/fluent/models/MonitorInner.java | 207 +++ .../fluent/models/MonitorProperties.java | 214 +++ .../fluent/models/OperationInner.java | 121 ++ .../models/OperationStatusResultInner.java | 243 +++ .../fluent/models/ProviderInstanceInner.java | 83 + .../models/ProviderInstanceProperties.java | 85 + .../workloads/fluent/models/package-info.java | 9 + .../workloads/fluent/package-info.java | 9 + .../workloads/implementation/MonitorImpl.java | 236 +++ .../implementation/MonitorsClientImpl.java | 1458 +++++++++++++++++ .../implementation/MonitorsImpl.java | 181 ++ .../implementation/OperationImpl.java | 50 + .../OperationStatusResultImpl.java | 75 + .../implementation/OperationsClientImpl.java | 274 ++++ .../implementation/OperationsImpl.java | 45 + .../implementation/ProviderInstanceImpl.java | 117 ++ .../ProviderInstancesClientImpl.java | 1177 +++++++++++++ .../implementation/ProviderInstancesImpl.java | 210 +++ .../workloads/implementation/Utils.java | 204 +++ .../WorkloadsClientBuilder.java | 142 ++ .../implementation/WorkloadsClientImpl.java | 318 ++++ .../implementation/package-info.java | 9 + .../workloads/models/ActionType.java | 35 + .../models/DB2ProviderInstanceProperties.java | 208 +++ .../workloads/models/Error.java | 103 ++ .../workloads/models/ErrorInnerError.java | 49 + .../HanaDbProviderInstanceProperties.java | 260 +++ .../models/ManagedRGConfiguration.java | 46 + .../workloads/models/Monitor.java | 319 ++++ .../workloads/models/MonitorListResult.java | 77 + .../models/MonitorPropertiesErrors.java | 21 + .../workloads/models/Monitors.java | 164 ++ ...MsSqlServerProviderInstanceProperties.java | 182 ++ .../workloads/models/Operation.java | 56 + .../workloads/models/OperationDisplay.java | 89 + .../workloads/models/OperationListResult.java | 58 + .../models/OperationStatusResult.java | 76 + .../workloads/models/Operations.java | 33 + .../models/OperationsDefinitionDisplay.java | 49 + .../models/OperationsDisplayDefinition.java | 151 ++ .../workloads/models/Origin.java | 41 + ...usHaClusterProviderInstanceProperties.java | 130 ++ ...rometheusOSProviderInstanceProperties.java | 52 + .../workloads/models/ProviderInstance.java | 126 ++ .../models/ProviderInstanceListResult.java | 77 + .../ProviderInstancePropertiesErrors.java | 21 + .../workloads/models/ProviderInstances.java | 159 ++ .../models/ProviderSpecificProperties.java | 36 + .../workloads/models/RoutingPreference.java | 38 + ...apNetWeaverProviderInstanceProperties.java | 287 ++++ .../workloads/models/Tags.java | 49 + .../WorkloadMonitorProvisioningState.java | 53 + .../workloads/models/package-info.java | 9 + .../workloads/package-info.java | 8 + .../src/main/java/module-info.java | 19 + .../generated/MonitorsCreateSamples.java | 49 + .../generated/MonitorsDeleteSamples.java | 22 + .../MonitorsGetByResourceGroupSamples.java | 22 + .../MonitorsListByResourceGroupSamples.java | 23 + .../generated/MonitorsListSamples.java | 22 + .../generated/MonitorsUpdateSamples.java | 58 + .../generated/OperationsListSamples.java | 22 + .../ProviderInstancesCreateSamples.java | 162 ++ .../ProviderInstancesDeleteSamples.java | 22 + .../ProviderInstancesGetSamples.java | 98 ++ .../ProviderInstancesListSamples.java | 23 + sdk/workloads/ci.yml | 39 + sdk/workloads/pom.xml | 53 + 79 files changed, 10749 insertions(+) create mode 100644 sdk/workloads/azure-resourcemanager-workloads/CHANGELOG.md create mode 100644 sdk/workloads/azure-resourcemanager-workloads/README.md create mode 100644 sdk/workloads/azure-resourcemanager-workloads/SAMPLE.md create mode 100644 sdk/workloads/azure-resourcemanager-workloads/pom.xml create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/WorkloadsManager.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/MonitorsClient.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/OperationsClient.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/ProviderInstancesClient.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/WorkloadsClient.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/MonitorInner.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/MonitorProperties.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/OperationInner.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/OperationStatusResultInner.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/ProviderInstanceInner.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/ProviderInstanceProperties.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/package-info.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/package-info.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/MonitorImpl.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/MonitorsClientImpl.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/MonitorsImpl.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationImpl.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationStatusResultImpl.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationsClientImpl.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationsImpl.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/ProviderInstanceImpl.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/ProviderInstancesClientImpl.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/ProviderInstancesImpl.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/Utils.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/WorkloadsClientBuilder.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/WorkloadsClientImpl.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/package-info.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ActionType.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/DB2ProviderInstanceProperties.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Error.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ErrorInnerError.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/HanaDbProviderInstanceProperties.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ManagedRGConfiguration.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Monitor.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/MonitorListResult.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/MonitorPropertiesErrors.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Monitors.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/MsSqlServerProviderInstanceProperties.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Operation.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationDisplay.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationListResult.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationStatusResult.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Operations.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationsDefinitionDisplay.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationsDisplayDefinition.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Origin.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/PrometheusHaClusterProviderInstanceProperties.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/PrometheusOSProviderInstanceProperties.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstance.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstanceListResult.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstancePropertiesErrors.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstances.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderSpecificProperties.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/RoutingPreference.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/SapNetWeaverProviderInstanceProperties.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Tags.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/WorkloadMonitorProvisioningState.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/package-info.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/package-info.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/main/java/module-info.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsCreateSamples.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsDeleteSamples.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsGetByResourceGroupSamples.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsListByResourceGroupSamples.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsListSamples.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsUpdateSamples.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/OperationsListSamples.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesCreateSamples.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesDeleteSamples.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesGetSamples.java create mode 100644 sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesListSamples.java create mode 100644 sdk/workloads/ci.yml create mode 100644 sdk/workloads/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index fd1d3b26933c..3d221936751d 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -340,6 +340,7 @@ com.azure.resourcemanager:azure-resourcemanager-servicelinker;1.0.0-beta.1;1.0.0 com.azure.resourcemanager:azure-resourcemanager-appcontainers;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-scvmm;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-hardwaresecuritymodules;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-workloads;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 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 0d08d4fb5914..1f6ce1b13a6f 100644 --- a/pom.xml +++ b/pom.xml @@ -985,6 +985,7 @@ sdk/videoanalyzer sdk/vmwarecloudsimple sdk/webpubsub + sdk/workloads diff --git a/sdk/workloads/azure-resourcemanager-workloads/CHANGELOG.md b/sdk/workloads/azure-resourcemanager-workloads/CHANGELOG.md new file mode 100644 index 000000000000..d1a3a904f709 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-05-15) + +- Azure Resource Manager Workloads client library for Java. This package contains Microsoft Azure SDK for Workloads Management SDK. Workloads client provides access to various workload operations. Package tag package-2021-12-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/workloads/azure-resourcemanager-workloads/README.md b/sdk/workloads/azure-resourcemanager-workloads/README.md new file mode 100644 index 000000000000..912f215b8f12 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Workloads client library for Java + +Azure Resource Manager Workloads client library for Java. + +This package contains Microsoft Azure SDK for Workloads Management SDK. Workloads client provides access to various workload operations. Package tag package-2021-12-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-workloads;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-workloads + 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] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of 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 environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +WorkloadsManager manager = WorkloadsManager + .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/workloads/azure-resourcemanager-workloads/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[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 diff --git a/sdk/workloads/azure-resourcemanager-workloads/SAMPLE.md b/sdk/workloads/azure-resourcemanager-workloads/SAMPLE.md new file mode 100644 index 000000000000..8d27261b6cd2 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/SAMPLE.md @@ -0,0 +1,534 @@ +# Code snippets and samples + + +## Monitors + +- [Create](#monitors_create) +- [Delete](#monitors_delete) +- [GetByResourceGroup](#monitors_getbyresourcegroup) +- [List](#monitors_list) +- [ListByResourceGroup](#monitors_listbyresourcegroup) +- [Update](#monitors_update) + +## Operations + +- [List](#operations_list) + +## ProviderInstances + +- [Create](#providerinstances_create) +- [Delete](#providerinstances_delete) +- [Get](#providerinstances_get) +- [List](#providerinstances_list) +### Monitors_Create + +```java +import com.azure.resourcemanager.workloads.models.ManagedRGConfiguration; +import com.azure.resourcemanager.workloads.models.RoutingPreference; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Monitors Create. */ +public final class MonitorsCreateSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_Create.json + */ + /** + * Sample code: Create a SAP Monitor. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createASAPMonitor(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .monitors() + .define("mySapMonitor") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf("key", "value")) + .withAppLocation("westus") + .withRoutingPreference(RoutingPreference.ROUTE_ALL) + .withManagedResourceGroupConfiguration(new ManagedRGConfiguration().withName("myManagedRg")) + .withLogAnalyticsWorkspaceArmId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace") + .withMonitorSubnet( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet") + .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 +import com.azure.core.util.Context; + +/** Samples for Monitors Delete. */ +public final class MonitorsDeleteSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_Delete.json + */ + /** + * Sample code: Deletes a SAP monitor. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void deletesASAPMonitor(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.monitors().delete("myResourceGroup", "mySapMonitor", Context.NONE); + } +} +``` + +### Monitors_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Monitors GetByResourceGroup. */ +public final class MonitorsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_Get.json + */ + /** + * Sample code: Get properties of a SAP monitor. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfASAPMonitor(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.monitors().getByResourceGroupWithResponse("myResourceGroup", "mySapMonitor", Context.NONE); + } +} +``` + +### Monitors_List + +```java +import com.azure.core.util.Context; + +/** Samples for Monitors List. */ +public final class MonitorsListSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_List.json + */ + /** + * Sample code: List all SAP Monitors in a subscription. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void listAllSAPMonitorsInASubscription(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.monitors().list(Context.NONE); + } +} +``` + +### Monitors_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Monitors ListByResourceGroup. */ +public final class MonitorsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_ListByRG.json + */ + /** + * Sample code: List all SAP Monitors in a resource group. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void listAllSAPMonitorsInAResourceGroup( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.monitors().listByResourceGroup("example-rg", Context.NONE); + } +} +``` + +### Monitors_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.workloads.models.Monitor; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Monitors Update. */ +public final class MonitorsUpdateSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_PatchTags_Delete.json + */ + /** + * Sample code: Delete Tags field of a SAP monitor. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void deleteTagsFieldOfASAPMonitor(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + Monitor resource = + manager + .monitors() + .getByResourceGroupWithResponse("myResourceGroup", "mySapMonitor", Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).apply(); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_PatchTags.json + */ + /** + * Sample code: Update Tags field of a SAP monitor. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void updateTagsFieldOfASAPMonitor(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + Monitor resource = + manager + .monitors() + .getByResourceGroupWithResponse("myResourceGroup", "mySapMonitor", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("testkey", "testvalue")).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; + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void operations(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### ProviderInstances_Create + +```java +import com.azure.resourcemanager.workloads.models.DB2ProviderInstanceProperties; +import com.azure.resourcemanager.workloads.models.HanaDbProviderInstanceProperties; +import com.azure.resourcemanager.workloads.models.MsSqlServerProviderInstanceProperties; +import com.azure.resourcemanager.workloads.models.PrometheusHaClusterProviderInstanceProperties; +import com.azure.resourcemanager.workloads.models.PrometheusOSProviderInstanceProperties; +import com.azure.resourcemanager.workloads.models.SapNetWeaverProviderInstanceProperties; +import java.util.Arrays; + +/** Samples for ProviderInstances Create. */ +public final class ProviderInstancesCreateSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/ProviderInstances_Create.json + */ + /** + * Sample code: Create a SAP Monitor Hana provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createASAPMonitorHanaProvider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .define("myProviderInstance") + .withExistingMonitor("myResourceGroup", "mySapMonitor") + .withProviderSettings( + new HanaDbProviderInstanceProperties() + .withHostname("name") + .withDbName("db") + .withSqlPort("0000") + .withInstanceNumber("00") + .withDbUsername("user") + .withDbPassword("****") + .withDbPasswordUri("") + .withDbSslCertificateUri("https://storageaccount.blob.core.windows.net/containername/filename") + .withSslHostnameInCertificate("xyz.domain.com")) + .create(); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/NetWeaverProviderInstances_Create.json + */ + /** + * Sample code: Create a SAP Monitor NetWeaver provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createASAPMonitorNetWeaverProvider( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .define("myProviderInstance") + .withExistingMonitor("myResourceGroup", "mySapMonitor") + .withProviderSettings( + new SapNetWeaverProviderInstanceProperties() + .withSapSid("SID") + .withSapHostname("name") + .withSapInstanceNr("00") + .withSapHostFileEntries(Arrays.asList("127.0.0.1 name fqdn")) + .withSapUsername("username") + .withSapPassword("****") + .withSapPasswordUri("") + .withSapClientId("111") + .withSapPortNumber("1234") + .withSapSslCertificateUri("https://storageaccount.blob.core.windows.net/containername/filename")) + .create(); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/MsSqlServerProviderInstance_Create.json + */ + /** + * Sample code: Create a MsSqlServer provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createAMsSqlServerProvider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .define("myProviderInstance") + .withExistingMonitor("myResourceGroup", "mySapMonitor") + .withProviderSettings( + new MsSqlServerProviderInstanceProperties() + .withHostname("hostname") + .withDbPort("5912") + .withDbUsername("user") + .withDbPassword("****") + .withDbPasswordUri("") + .withSapSid("sid")) + .create(); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Create.json + */ + /** + * Sample code: Create a PrometheusHaCluster provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createAPrometheusHaClusterProvider( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .define("myProviderInstance") + .withExistingMonitor("myResourceGroup", "mySapMonitor") + .withProviderSettings( + new PrometheusHaClusterProviderInstanceProperties() + .withPrometheusUrl("http://192.168.0.0:9090/metrics") + .withHostname("hostname") + .withSid("sid") + .withClusterName("clusterName")) + .create(); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/Db2ProviderInstances_Create.json + */ + /** + * Sample code: Create a Db2 provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createADb2Provider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .define("myProviderInstance") + .withExistingMonitor("myResourceGroup", "mySapMonitor") + .withProviderSettings( + new DB2ProviderInstanceProperties() + .withHostname("hostname") + .withDbName("dbName") + .withDbPort("dbPort") + .withDbUsername("username") + .withDbPassword("password") + .withDbPasswordUri("") + .withSapSid("SID")) + .create(); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusOSProviderInstances_Create.json + */ + /** + * Sample code: Create a OS provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createAOSProvider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .define("myProviderInstance") + .withExistingMonitor("myResourceGroup", "mySapMonitor") + .withProviderSettings( + new PrometheusOSProviderInstanceProperties().withPrometheusUrl("http://192.168.0.0:9090/metrics")) + .create(); + } +} +``` + +### ProviderInstances_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ProviderInstances Delete. */ +public final class ProviderInstancesDeleteSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/ProviderInstances_Delete.json + */ + /** + * Sample code: Deletes a SAP monitor provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void deletesASAPMonitorProvider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.providerInstances().delete("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } +} +``` + +### ProviderInstances_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ProviderInstances Get. */ +public final class ProviderInstancesGetSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/ProviderInstances_Get.json + */ + /** + * Sample code: Get properties of a SAP monitor Hana provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfASAPMonitorHanaProvider( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .getWithResponse("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Get.json + */ + /** + * Sample code: Get properties of a PrometheusHaCluster provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfAPrometheusHaClusterProvider( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .getWithResponse("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusOSProviderInstances_Get.json + */ + /** + * Sample code: Get properties of a OS provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfAOSProvider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .getWithResponse("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/Db2ProviderInstances_Get.json + */ + /** + * Sample code: Get properties of a Db2 provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfADb2Provider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .getWithResponse("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/MsSqlServerProviderInstance_Get.json + */ + /** + * Sample code: Get properties of a MsSqlServer provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfAMsSqlServerProvider( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .getWithResponse("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/NetWeaverProviderInstances_Get.json + */ + /** + * Sample code: Get properties of a SAP monitor NetWeaver provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfASAPMonitorNetWeaverProvider( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .getWithResponse("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } +} +``` + +### ProviderInstances_List + +```java +import com.azure.core.util.Context; + +/** Samples for ProviderInstances List. */ +public final class ProviderInstancesListSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/ProviderInstances_List.json + */ + /** + * Sample code: List all SAP Monitors providers in a subscription. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void listAllSAPMonitorsProvidersInASubscription( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.providerInstances().list("myResourceGroup", "mySapMonitor", Context.NONE); + } +} +``` + diff --git a/sdk/workloads/azure-resourcemanager-workloads/pom.xml b/sdk/workloads/azure-resourcemanager-workloads/pom.xml new file mode 100644 index 000000000000..be7a8ded309c --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/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-workloads + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Workloads Management + This package contains Microsoft Azure SDK for Workloads Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Workloads client provides access to various workload operations. Package tag package-2021-12-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.28.0 + + + com.azure + azure-core-management + 1.6.0 + + + diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/WorkloadsManager.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/WorkloadsManager.java new file mode 100644 index 000000000000..c6339fbfe937 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/WorkloadsManager.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads; + +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.workloads.fluent.WorkloadsClient; +import com.azure.resourcemanager.workloads.implementation.MonitorsImpl; +import com.azure.resourcemanager.workloads.implementation.OperationsImpl; +import com.azure.resourcemanager.workloads.implementation.ProviderInstancesImpl; +import com.azure.resourcemanager.workloads.implementation.WorkloadsClientBuilder; +import com.azure.resourcemanager.workloads.models.Monitors; +import com.azure.resourcemanager.workloads.models.Operations; +import com.azure.resourcemanager.workloads.models.ProviderInstances; +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 WorkloadsManager. Workloads client provides access to various workload operations. */ +public final class WorkloadsManager { + private Operations operations; + + private Monitors monitors; + + private ProviderInstances providerInstances; + + private final WorkloadsClient clientObject; + + private WorkloadsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new WorkloadsClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Workloads service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Workloads service API instance. + */ + public static WorkloadsManager 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 Workloads service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Workloads service API instance. + */ + public static WorkloadsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new WorkloadsManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create WorkloadsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new WorkloadsManager.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 Workloads service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Workloads service API instance. + */ + public WorkloadsManager 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.workloads") + .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 WorkloadsManager(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 Monitors. It manages Monitor. + * + * @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 ProviderInstances. It manages ProviderInstance. + * + * @return Resource collection API of ProviderInstances. + */ + public ProviderInstances providerInstances() { + if (this.providerInstances == null) { + this.providerInstances = new ProviderInstancesImpl(clientObject.getProviderInstances(), this); + } + return providerInstances; + } + + /** + * @return Wrapped service client WorkloadsClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public WorkloadsClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/MonitorsClient.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/MonitorsClient.java new file mode 100644 index 000000000000..6413c64f2145 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/MonitorsClient.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.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.workloads.fluent.models.MonitorInner; +import com.azure.resourcemanager.workloads.fluent.models.OperationStatusResultInner; +import com.azure.resourcemanager.workloads.models.Tags; + +/** An instance of this class provides access to all the operations defined in MonitorsClient. */ +public interface MonitorsClient { + /** + * Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP + * monitor. + * + * @throws com.azure.core.management.exception.ManagementException 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 SAP monitors in the specified subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP + * monitor. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SAP monitors in the specified subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a list of SAP monitors in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SAP monitors in the specified resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of SAP monitors in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SAP monitors in the specified resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 properties of a SAP monitor for the specified subscription, resource group, and resource name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MonitorInner getByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP 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 properties of a SAP monitor for the specified subscription, resource group, and resource name along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context); + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 sAP monitor info on Azure (ARM properties and SAP monitor + * properties). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MonitorInner> beginCreate( + String resourceGroupName, String monitorName, MonitorInner monitorParameter); + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 sAP monitor info on Azure (ARM properties and SAP monitor + * properties). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MonitorInner> beginCreate( + String resourceGroupName, String monitorName, MonitorInner monitorParameter, Context context); + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MonitorInner create(String resourceGroupName, String monitorName, MonitorInner monitorParameter); + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MonitorInner create(String resourceGroupName, String monitorName, MonitorInner monitorParameter, Context context); + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OperationStatusResultInner> beginDelete( + String resourceGroupName, String monitorName); + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP 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 the {@link SyncPoller} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OperationStatusResultInner> beginDelete( + String resourceGroupName, String monitorName, Context context); + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusResultInner delete(String resourceGroupName, String monitorName); + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP 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 the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusResultInner delete(String resourceGroupName, String monitorName, Context context); + + /** + * Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param tagsParameter Request body that only contains the new Tags field. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MonitorInner update(String resourceGroupName, String monitorName, Tags tagsParameter); + + /** + * Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param tagsParameter Request body that only contains the new Tags field. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties) along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String monitorName, Tags tagsParameter, Context context); +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/OperationsClient.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/OperationsClient.java new file mode 100644 index 000000000000..d7f248a0848c --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/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.workloads.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.workloads.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all the available API operations under this PR. + * + * @throws com.azure.core.management.exception.ManagementException 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(); + + /** + * Lists all the available API operations under this PR. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/ProviderInstancesClient.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/ProviderInstancesClient.java new file mode 100644 index 000000000000..eab1895c11b5 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/ProviderInstancesClient.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.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.workloads.fluent.models.OperationStatusResultInner; +import com.azure.resourcemanager.workloads.fluent.models.ProviderInstanceInner; + +/** An instance of this class provides access to all the operations defined in ProviderInstancesClient. */ +public interface ProviderInstancesClient { + /** + * Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each + * provider instances. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 list of provider instances in the specified SAP monitor as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String monitorName); + + /** + * Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each + * provider instances. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP 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 a list of provider instances in the specified SAP monitor as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String monitorName, Context context); + + /** + * Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a provider instance for the specified subscription, resource group, Monitor name, and + * resource name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProviderInstanceInner get(String resourceGroupName, String monitorName, String providerInstanceName); + + /** + * Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a provider instance for the specified subscription, resource group, Monitor name, and + * resource name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String monitorName, String providerInstanceName, Context context); + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 provider instance associated with monitor. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProviderInstanceInner> beginCreate( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter); + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 provider instance associated with monitor. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProviderInstanceInner> beginCreate( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter, + Context context); + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provider instance associated with monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProviderInstanceInner create( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter); + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provider instance associated with monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProviderInstanceInner create( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter, + Context context); + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OperationStatusResultInner> beginDelete( + String resourceGroupName, String monitorName, String providerInstanceName); + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OperationStatusResultInner> beginDelete( + String resourceGroupName, String monitorName, String providerInstanceName, Context context); + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusResultInner delete(String resourceGroupName, String monitorName, String providerInstanceName); + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusResultInner delete( + String resourceGroupName, String monitorName, String providerInstanceName, Context context); +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/WorkloadsClient.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/WorkloadsClient.java new file mode 100644 index 000000000000..11d9428973b5 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/WorkloadsClient.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.workloads.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for WorkloadsClient class. */ +public interface WorkloadsClient { + /** + * 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 MonitorsClient object to access its operations. + * + * @return the MonitorsClient object. + */ + MonitorsClient getMonitors(); + + /** + * Gets the ProviderInstancesClient object to access its operations. + * + * @return the ProviderInstancesClient object. + */ + ProviderInstancesClient getProviderInstances(); +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/MonitorInner.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/MonitorInner.java new file mode 100644 index 000000000000..e9738c07fd22 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/MonitorInner.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.workloads.models.ManagedRGConfiguration; +import com.azure.resourcemanager.workloads.models.MonitorPropertiesErrors; +import com.azure.resourcemanager.workloads.models.RoutingPreference; +import com.azure.resourcemanager.workloads.models.WorkloadMonitorProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** SAP monitor info on Azure (ARM properties and SAP monitor properties). */ +@Fluent +public final class MonitorInner extends Resource { + /* + * SAP monitor properties + */ + @JsonProperty(value = "properties") + private MonitorProperties innerProperties; + + /** + * Get the innerProperties property: SAP monitor properties. + * + * @return the innerProperties value. + */ + private MonitorProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public MonitorInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MonitorInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: State of provisioning of the monitor. + * + * @return the provisioningState value. + */ + public WorkloadMonitorProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the errors property: Defines the SAP monitor errors. + * + * @return the errors value. + */ + public MonitorPropertiesErrors errors() { + return this.innerProperties() == null ? null : this.innerProperties().errors(); + } + + /** + * Get the appLocation property: The monitor resources will be deployed in the monitoring region. The subnet region + * should be same as the monitoring region. + * + * @return the appLocation value. + */ + public String appLocation() { + return this.innerProperties() == null ? null : this.innerProperties().appLocation(); + } + + /** + * Set the appLocation property: The monitor resources will be deployed in the monitoring region. The subnet region + * should be same as the monitoring region. + * + * @param appLocation the appLocation value to set. + * @return the MonitorInner object itself. + */ + public MonitorInner withAppLocation(String appLocation) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withAppLocation(appLocation); + return this; + } + + /** + * Get the routingPreference property: Sets the routing preference of the monitor. By default only RFC1918 traffic + * is routed to the customer VNET. + * + * @return the routingPreference value. + */ + public RoutingPreference routingPreference() { + return this.innerProperties() == null ? null : this.innerProperties().routingPreference(); + } + + /** + * Set the routingPreference property: Sets the routing preference of the monitor. By default only RFC1918 traffic + * is routed to the customer VNET. + * + * @param routingPreference the routingPreference value to set. + * @return the MonitorInner object itself. + */ + public MonitorInner withRoutingPreference(RoutingPreference routingPreference) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withRoutingPreference(routingPreference); + return this; + } + + /** + * Get the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @return the managedResourceGroupConfiguration value. + */ + public ManagedRGConfiguration managedResourceGroupConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().managedResourceGroupConfiguration(); + } + + /** + * Set the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @param managedResourceGroupConfiguration the managedResourceGroupConfiguration value to set. + * @return the MonitorInner object itself. + */ + public MonitorInner withManagedResourceGroupConfiguration( + ManagedRGConfiguration managedResourceGroupConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withManagedResourceGroupConfiguration(managedResourceGroupConfiguration); + return this; + } + + /** + * Get the logAnalyticsWorkspaceArmId property: The ARM ID of the Log Analytics Workspace that is used for + * monitoring. + * + * @return the logAnalyticsWorkspaceArmId value. + */ + public String logAnalyticsWorkspaceArmId() { + return this.innerProperties() == null ? null : this.innerProperties().logAnalyticsWorkspaceArmId(); + } + + /** + * Set the logAnalyticsWorkspaceArmId property: The ARM ID of the Log Analytics Workspace that is used for + * monitoring. + * + * @param logAnalyticsWorkspaceArmId the logAnalyticsWorkspaceArmId value to set. + * @return the MonitorInner object itself. + */ + public MonitorInner withLogAnalyticsWorkspaceArmId(String logAnalyticsWorkspaceArmId) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withLogAnalyticsWorkspaceArmId(logAnalyticsWorkspaceArmId); + return this; + } + + /** + * Get the monitorSubnet property: The subnet which the SAP monitor will be deployed in. + * + * @return the monitorSubnet value. + */ + public String monitorSubnet() { + return this.innerProperties() == null ? null : this.innerProperties().monitorSubnet(); + } + + /** + * Set the monitorSubnet property: The subnet which the SAP monitor will be deployed in. + * + * @param monitorSubnet the monitorSubnet value to set. + * @return the MonitorInner object itself. + */ + public MonitorInner withMonitorSubnet(String monitorSubnet) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withMonitorSubnet(monitorSubnet); + return this; + } + + /** + * Get the msiArmId property: The ARM ID of the MSI used for monitoring. + * + * @return the msiArmId value. + */ + public String msiArmId() { + return this.innerProperties() == null ? null : this.innerProperties().msiArmId(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/MonitorProperties.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/MonitorProperties.java new file mode 100644 index 000000000000..a1b231c852b1 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/MonitorProperties.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.workloads.models.ManagedRGConfiguration; +import com.azure.resourcemanager.workloads.models.MonitorPropertiesErrors; +import com.azure.resourcemanager.workloads.models.RoutingPreference; +import com.azure.resourcemanager.workloads.models.WorkloadMonitorProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a SAP monitor. */ +@Fluent +public final class MonitorProperties { + /* + * State of provisioning of the monitor. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private WorkloadMonitorProvisioningState provisioningState; + + /* + * Defines the SAP monitor errors. + */ + @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY) + private MonitorPropertiesErrors errors; + + /* + * The monitor resources will be deployed in the monitoring region. The + * subnet region should be same as the monitoring region. + */ + @JsonProperty(value = "appLocation") + private String appLocation; + + /* + * Sets the routing preference of the monitor. By default only RFC1918 + * traffic is routed to the customer VNET. + */ + @JsonProperty(value = "routingPreference") + private RoutingPreference routingPreference; + + /* + * Managed resource group configuration + */ + @JsonProperty(value = "managedResourceGroupConfiguration") + private ManagedRGConfiguration managedResourceGroupConfiguration; + + /* + * The ARM ID of the Log Analytics Workspace that is used for monitoring. + */ + @JsonProperty(value = "logAnalyticsWorkspaceArmId") + private String logAnalyticsWorkspaceArmId; + + /* + * The subnet which the SAP monitor will be deployed in + */ + @JsonProperty(value = "monitorSubnet") + private String monitorSubnet; + + /* + * The ARM ID of the MSI used for monitoring. + */ + @JsonProperty(value = "msiArmId", access = JsonProperty.Access.WRITE_ONLY) + private String msiArmId; + + /** + * Get the provisioningState property: State of provisioning of the monitor. + * + * @return the provisioningState value. + */ + public WorkloadMonitorProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the errors property: Defines the SAP monitor errors. + * + * @return the errors value. + */ + public MonitorPropertiesErrors errors() { + return this.errors; + } + + /** + * Get the appLocation property: The monitor resources will be deployed in the monitoring region. The subnet region + * should be same as the monitoring region. + * + * @return the appLocation value. + */ + public String appLocation() { + return this.appLocation; + } + + /** + * Set the appLocation property: The monitor resources will be deployed in the monitoring region. The subnet region + * should be same as the monitoring region. + * + * @param appLocation the appLocation value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withAppLocation(String appLocation) { + this.appLocation = appLocation; + return this; + } + + /** + * Get the routingPreference property: Sets the routing preference of the monitor. By default only RFC1918 traffic + * is routed to the customer VNET. + * + * @return the routingPreference value. + */ + public RoutingPreference routingPreference() { + return this.routingPreference; + } + + /** + * Set the routingPreference property: Sets the routing preference of the monitor. By default only RFC1918 traffic + * is routed to the customer VNET. + * + * @param routingPreference the routingPreference value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withRoutingPreference(RoutingPreference routingPreference) { + this.routingPreference = routingPreference; + return this; + } + + /** + * Get the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @return the managedResourceGroupConfiguration value. + */ + public ManagedRGConfiguration managedResourceGroupConfiguration() { + return this.managedResourceGroupConfiguration; + } + + /** + * Set the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @param managedResourceGroupConfiguration the managedResourceGroupConfiguration value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withManagedResourceGroupConfiguration( + ManagedRGConfiguration managedResourceGroupConfiguration) { + this.managedResourceGroupConfiguration = managedResourceGroupConfiguration; + return this; + } + + /** + * Get the logAnalyticsWorkspaceArmId property: The ARM ID of the Log Analytics Workspace that is used for + * monitoring. + * + * @return the logAnalyticsWorkspaceArmId value. + */ + public String logAnalyticsWorkspaceArmId() { + return this.logAnalyticsWorkspaceArmId; + } + + /** + * Set the logAnalyticsWorkspaceArmId property: The ARM ID of the Log Analytics Workspace that is used for + * monitoring. + * + * @param logAnalyticsWorkspaceArmId the logAnalyticsWorkspaceArmId value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withLogAnalyticsWorkspaceArmId(String logAnalyticsWorkspaceArmId) { + this.logAnalyticsWorkspaceArmId = logAnalyticsWorkspaceArmId; + return this; + } + + /** + * Get the monitorSubnet property: The subnet which the SAP monitor will be deployed in. + * + * @return the monitorSubnet value. + */ + public String monitorSubnet() { + return this.monitorSubnet; + } + + /** + * Set the monitorSubnet property: The subnet which the SAP monitor will be deployed in. + * + * @param monitorSubnet the monitorSubnet value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withMonitorSubnet(String monitorSubnet) { + this.monitorSubnet = monitorSubnet; + return this; + } + + /** + * Get the msiArmId property: The ARM ID of the MSI used for monitoring. + * + * @return the msiArmId value. + */ + public String msiArmId() { + return this.msiArmId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errors() != null) { + errors().validate(); + } + if (managedResourceGroupConfiguration() != null) { + managedResourceGroupConfiguration().validate(); + } + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/OperationInner.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/OperationInner.java new file mode 100644 index 000000000000..2d8c1bea3db7 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/OperationInner.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.workloads.models.ActionType; +import com.azure.resourcemanager.workloads.models.OperationDisplay; +import com.azure.resourcemanager.workloads.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; + + /** + * 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/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/OperationStatusResultInner.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/OperationStatusResultInner.java new file mode 100644 index 000000000000..6acba2304ee6 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/OperationStatusResultInner.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The current status of an async operation. */ +@Fluent +public final class OperationStatusResultInner { + /* + * Fully qualified ID for the async operation. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Name of the async operation. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Operation status. + */ + @JsonProperty(value = "status", required = true) + private String status; + + /* + * Percent of the operation that is complete. + */ + @JsonProperty(value = "percentComplete") + private Float percentComplete; + + /* + * The start time of the operation. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * The end time of the operation. + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /* + * The operations list. + */ + @JsonProperty(value = "operations") + private List operations; + + /* + * If present, details of the operation error. + */ + @JsonProperty(value = "error") + private ManagementError error; + + /** + * Get the id property: Fully qualified ID for the async operation. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Fully qualified ID for the async operation. + * + * @param id the id value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: Name of the async operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the async operation. + * + * @param name the name value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: Operation status. + * + * @param status the status value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the percentComplete property: Percent of the operation that is complete. + * + * @return the percentComplete value. + */ + public Float percentComplete() { + return this.percentComplete; + } + + /** + * Set the percentComplete property: Percent of the operation that is complete. + * + * @param percentComplete the percentComplete value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withPercentComplete(Float percentComplete) { + this.percentComplete = percentComplete; + return this; + } + + /** + * Get the startTime property: The start time of the operation. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time of the operation. + * + * @param startTime the startTime value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The end time of the operation. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end time of the operation. + * + * @param endTime the endTime value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the operations property: The operations list. + * + * @return the operations value. + */ + public List operations() { + return this.operations; + } + + /** + * Set the operations property: The operations list. + * + * @param operations the operations value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withOperations(List operations) { + this.operations = operations; + return this; + } + + /** + * Get the error property: If present, details of the operation error. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Set the error property: If present, details of the operation error. + * + * @param error the error value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withError(ManagementError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model OperationStatusResultInner")); + } + if (operations() != null) { + operations().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationStatusResultInner.class); +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/ProviderInstanceInner.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/ProviderInstanceInner.java new file mode 100644 index 000000000000..1f94cf60502e --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/ProviderInstanceInner.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.workloads.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.workloads.models.ProviderInstancePropertiesErrors; +import com.azure.resourcemanager.workloads.models.ProviderSpecificProperties; +import com.azure.resourcemanager.workloads.models.WorkloadMonitorProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A provider instance associated with monitor. */ +@Fluent +public final class ProviderInstanceInner extends ProxyResource { + /* + * Provider Instance properties + */ + @JsonProperty(value = "properties") + private ProviderInstanceProperties innerProperties; + + /** + * Get the innerProperties property: Provider Instance properties. + * + * @return the innerProperties value. + */ + private ProviderInstanceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the provisioningState property: State of provisioning of the provider instance. + * + * @return the provisioningState value. + */ + public WorkloadMonitorProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the errors property: Defines the provider instance errors. + * + * @return the errors value. + */ + public ProviderInstancePropertiesErrors errors() { + return this.innerProperties() == null ? null : this.innerProperties().errors(); + } + + /** + * Get the providerSettings property: Defines the provider instance errors. + * + * @return the providerSettings value. + */ + public ProviderSpecificProperties providerSettings() { + return this.innerProperties() == null ? null : this.innerProperties().providerSettings(); + } + + /** + * Set the providerSettings property: Defines the provider instance errors. + * + * @param providerSettings the providerSettings value to set. + * @return the ProviderInstanceInner object itself. + */ + public ProviderInstanceInner withProviderSettings(ProviderSpecificProperties providerSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new ProviderInstanceProperties(); + } + this.innerProperties().withProviderSettings(providerSettings); + 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/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/ProviderInstanceProperties.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/ProviderInstanceProperties.java new file mode 100644 index 000000000000..b35c2f48d0b5 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/ProviderInstanceProperties.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.workloads.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.workloads.models.ProviderInstancePropertiesErrors; +import com.azure.resourcemanager.workloads.models.ProviderSpecificProperties; +import com.azure.resourcemanager.workloads.models.WorkloadMonitorProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a provider instance. */ +@Fluent +public final class ProviderInstanceProperties { + /* + * State of provisioning of the provider instance + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private WorkloadMonitorProvisioningState provisioningState; + + /* + * Defines the provider instance errors. + */ + @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY) + private ProviderInstancePropertiesErrors errors; + + /* + * Defines the provider instance errors. + */ + @JsonProperty(value = "providerSettings") + private ProviderSpecificProperties providerSettings; + + /** + * Get the provisioningState property: State of provisioning of the provider instance. + * + * @return the provisioningState value. + */ + public WorkloadMonitorProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the errors property: Defines the provider instance errors. + * + * @return the errors value. + */ + public ProviderInstancePropertiesErrors errors() { + return this.errors; + } + + /** + * Get the providerSettings property: Defines the provider instance errors. + * + * @return the providerSettings value. + */ + public ProviderSpecificProperties providerSettings() { + return this.providerSettings; + } + + /** + * Set the providerSettings property: Defines the provider instance errors. + * + * @param providerSettings the providerSettings value to set. + * @return the ProviderInstanceProperties object itself. + */ + public ProviderInstanceProperties withProviderSettings(ProviderSpecificProperties providerSettings) { + this.providerSettings = providerSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errors() != null) { + errors().validate(); + } + if (providerSettings() != null) { + providerSettings().validate(); + } + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/package-info.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/package-info.java new file mode 100644 index 000000000000..d00c894e9edc --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for WorkloadsClient. Workloads client provides access to various workload + * operations. + */ +package com.azure.resourcemanager.workloads.fluent.models; diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/package-info.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/package-info.java new file mode 100644 index 000000000000..66c382bfea31 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for WorkloadsClient. Workloads client provides access to various workload + * operations. + */ +package com.azure.resourcemanager.workloads.fluent; diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/MonitorImpl.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/MonitorImpl.java new file mode 100644 index 000000000000..9a7eb104c504 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/MonitorImpl.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.workloads.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.workloads.fluent.models.MonitorInner; +import com.azure.resourcemanager.workloads.models.ManagedRGConfiguration; +import com.azure.resourcemanager.workloads.models.Monitor; +import com.azure.resourcemanager.workloads.models.MonitorPropertiesErrors; +import com.azure.resourcemanager.workloads.models.RoutingPreference; +import com.azure.resourcemanager.workloads.models.Tags; +import com.azure.resourcemanager.workloads.models.WorkloadMonitorProvisioningState; +import java.util.Collections; +import java.util.Map; + +public final class MonitorImpl implements Monitor, Monitor.Definition, Monitor.Update { + private MonitorInner innerObject; + + private final com.azure.resourcemanager.workloads.WorkloadsManager 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 WorkloadMonitorProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public MonitorPropertiesErrors errors() { + return this.innerModel().errors(); + } + + public String appLocation() { + return this.innerModel().appLocation(); + } + + public RoutingPreference routingPreference() { + return this.innerModel().routingPreference(); + } + + public ManagedRGConfiguration managedResourceGroupConfiguration() { + return this.innerModel().managedResourceGroupConfiguration(); + } + + public String logAnalyticsWorkspaceArmId() { + return this.innerModel().logAnalyticsWorkspaceArmId(); + } + + public String monitorSubnet() { + return this.innerModel().monitorSubnet(); + } + + public String msiArmId() { + return this.innerModel().msiArmId(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public MonitorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.workloads.WorkloadsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String monitorName; + + private Tags updateTagsParameter; + + public MonitorImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Monitor create() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .create(resourceGroupName, monitorName, this.innerModel(), Context.NONE); + return this; + } + + public Monitor create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .create(resourceGroupName, monitorName, this.innerModel(), context); + return this; + } + + MonitorImpl(String name, com.azure.resourcemanager.workloads.WorkloadsManager serviceManager) { + this.innerObject = new MonitorInner(); + this.serviceManager = serviceManager; + this.monitorName = name; + } + + public MonitorImpl update() { + this.updateTagsParameter = new Tags(); + return this; + } + + public Monitor apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .updateWithResponse(resourceGroupName, monitorName, updateTagsParameter, Context.NONE) + .getValue(); + return this; + } + + public Monitor apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .updateWithResponse(resourceGroupName, monitorName, updateTagsParameter, context) + .getValue(); + return this; + } + + MonitorImpl(MonitorInner innerObject, com.azure.resourcemanager.workloads.WorkloadsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.monitorName = Utils.getValueFromIdByName(innerObject.id(), "monitors"); + } + + public Monitor refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .getByResourceGroupWithResponse(resourceGroupName, monitorName, Context.NONE) + .getValue(); + return this; + } + + public Monitor refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .getByResourceGroupWithResponse(resourceGroupName, monitorName, context) + .getValue(); + return this; + } + + public MonitorImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public MonitorImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public MonitorImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateTagsParameter.withTags(tags); + return this; + } + } + + public MonitorImpl withAppLocation(String appLocation) { + this.innerModel().withAppLocation(appLocation); + return this; + } + + public MonitorImpl withRoutingPreference(RoutingPreference routingPreference) { + this.innerModel().withRoutingPreference(routingPreference); + return this; + } + + public MonitorImpl withManagedResourceGroupConfiguration(ManagedRGConfiguration managedResourceGroupConfiguration) { + this.innerModel().withManagedResourceGroupConfiguration(managedResourceGroupConfiguration); + return this; + } + + public MonitorImpl withLogAnalyticsWorkspaceArmId(String logAnalyticsWorkspaceArmId) { + this.innerModel().withLogAnalyticsWorkspaceArmId(logAnalyticsWorkspaceArmId); + return this; + } + + public MonitorImpl withMonitorSubnet(String monitorSubnet) { + this.innerModel().withMonitorSubnet(monitorSubnet); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/MonitorsClientImpl.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/MonitorsClientImpl.java new file mode 100644 index 000000000000..19fbee18ef35 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/MonitorsClientImpl.java @@ -0,0 +1,1458 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.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.workloads.fluent.MonitorsClient; +import com.azure.resourcemanager.workloads.fluent.models.MonitorInner; +import com.azure.resourcemanager.workloads.fluent.models.OperationStatusResultInner; +import com.azure.resourcemanager.workloads.models.MonitorListResult; +import com.azure.resourcemanager.workloads.models.Tags; +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 WorkloadsClientImpl client; + + /** + * Initializes an instance of MonitorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MonitorsClientImpl(WorkloadsClientImpl client) { + this.service = RestProxy.create(MonitorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for WorkloadsClientMonitors to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "WorkloadsClientMonit") + private interface MonitorsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/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/Microsoft.Workloads/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/Microsoft.Workloads/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/Microsoft.Workloads/monitors" + + "/{monitorName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") MonitorInner monitorParameter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/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, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/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") Tags tagsParameter, + @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); + + @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); + } + + /** + * Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP + * monitor. + * + * @throws ManagementException 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 SAP monitors in the specified subscription 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())); + } + + /** + * Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP + * monitor. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SAP monitors in the specified subscription 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)); + } + + /** + * Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP + * monitor. + * + * @throws ManagementException 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 SAP monitors in the specified subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP + * monitor. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SAP monitors in the specified subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP + * monitor. + * + * @throws ManagementException 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 SAP monitors in the specified subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP + * monitor. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SAP monitors in the specified subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a list of SAP monitors in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SAP monitors in the specified resource group 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())); + } + + /** + * Gets a list of SAP monitors in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SAP monitors in the specified resource group 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)); + } + + /** + * Gets a list of SAP monitors in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SAP monitors in the specified resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of SAP monitors in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SAP monitors in the specified resource group 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)); + } + + /** + * Gets a list of SAP monitors in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SAP monitors in the specified resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets a list of SAP monitors in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SAP monitors in the specified resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 properties of a SAP monitor for the specified subscription, resource group, and resource name 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())); + } + + /** + * Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 properties of a SAP monitor for the specified subscription, resource group, and resource name 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); + } + + /** + * Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 properties of a SAP monitor for the specified subscription, resource group, and resource name 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())); + } + + /** + * Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 properties of a SAP monitor for the specified subscription, resource group, and resource name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MonitorInner getByResourceGroup(String resourceGroupName, String monitorName) { + return getByResourceGroupAsync(resourceGroupName, monitorName).block(); + } + + /** + * Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 properties of a SAP monitor for the specified subscription, resource group, and resource name along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, monitorName, context).block(); + } + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties) along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String monitorName, MonitorInner monitorParameter) { + 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 (monitorParameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter monitorParameter is required and cannot be null.")); + } else { + monitorParameter.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + monitorParameter, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties) along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String monitorName, MonitorInner monitorParameter, 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 (monitorParameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter monitorParameter is required and cannot be null.")); + } else { + monitorParameter.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + monitorParameter, + accept, + context); + } + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 sAP monitor info on Azure (ARM properties and SAP monitor + * properties). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MonitorInner> beginCreateAsync( + String resourceGroupName, String monitorName, MonitorInner monitorParameter) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, monitorName, monitorParameter); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), MonitorInner.class, MonitorInner.class, this.client.getContext()); + } + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 sAP monitor info on Azure (ARM properties and SAP monitor + * properties). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MonitorInner> beginCreateAsync( + String resourceGroupName, String monitorName, MonitorInner monitorParameter, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, monitorName, monitorParameter, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), MonitorInner.class, MonitorInner.class, context); + } + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 sAP monitor info on Azure (ARM properties and SAP monitor + * properties). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MonitorInner> beginCreate( + String resourceGroupName, String monitorName, MonitorInner monitorParameter) { + return beginCreateAsync(resourceGroupName, monitorName, monitorParameter).getSyncPoller(); + } + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 sAP monitor info on Azure (ARM properties and SAP monitor + * properties). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MonitorInner> beginCreate( + String resourceGroupName, String monitorName, MonitorInner monitorParameter, Context context) { + return beginCreateAsync(resourceGroupName, monitorName, monitorParameter, context).getSyncPoller(); + } + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties) on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String monitorName, MonitorInner monitorParameter) { + return beginCreateAsync(resourceGroupName, monitorName, monitorParameter) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties) on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String monitorName, MonitorInner monitorParameter, Context context) { + return beginCreateAsync(resourceGroupName, monitorName, monitorParameter, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MonitorInner create(String resourceGroupName, String monitorName, MonitorInner monitorParameter) { + return createAsync(resourceGroupName, monitorName, monitorParameter).block(); + } + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param monitorParameter Request body representing a SAP Monitor. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MonitorInner create( + String resourceGroupName, String monitorName, MonitorInner monitorParameter, Context context) { + return createAsync(resourceGroupName, monitorName, monitorParameter, context).block(); + } + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 current status of an async operation along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(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 + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 current status of an async operation along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + 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 + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context); + } + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OperationStatusResultInner> beginDeleteAsync( + String resourceGroupName, String monitorName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, monitorName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OperationStatusResultInner.class, + OperationStatusResultInner.class, + this.client.getContext()); + } + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OperationStatusResultInner> beginDeleteAsync( + String resourceGroupName, String monitorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, monitorName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OperationStatusResultInner.class, + OperationStatusResultInner.class, + context); + } + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OperationStatusResultInner> beginDelete( + String resourceGroupName, String monitorName) { + return beginDeleteAsync(resourceGroupName, monitorName).getSyncPoller(); + } + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OperationStatusResultInner> beginDelete( + String resourceGroupName, String monitorName, Context context) { + return beginDeleteAsync(resourceGroupName, monitorName, context).getSyncPoller(); + } + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 current status of an async operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String monitorName) { + return beginDeleteAsync(resourceGroupName, monitorName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 current status of an async operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String monitorName, Context context) { + return beginDeleteAsync(resourceGroupName, monitorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusResultInner delete(String resourceGroupName, String monitorName) { + return deleteAsync(resourceGroupName, monitorName).block(); + } + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusResultInner delete(String resourceGroupName, String monitorName, Context context) { + return deleteAsync(resourceGroupName, monitorName, context).block(); + } + + /** + * Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param tagsParameter Request body that only contains the new Tags field. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties) along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, Tags tagsParameter) { + 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 (tagsParameter == null) { + return Mono.error(new IllegalArgumentException("Parameter tagsParameter is required and cannot be null.")); + } else { + tagsParameter.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + tagsParameter, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param tagsParameter Request body that only contains the new Tags field. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties) along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, Tags tagsParameter, 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 (tagsParameter == null) { + return Mono.error(new IllegalArgumentException("Parameter tagsParameter is required and cannot be null.")); + } else { + tagsParameter.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, + tagsParameter, + accept, + context); + } + + /** + * Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param tagsParameter Request body that only contains the new Tags field. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties) on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String monitorName, Tags tagsParameter) { + return updateWithResponseAsync(resourceGroupName, monitorName, tagsParameter) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param tagsParameter Request body that only contains the new Tags field. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MonitorInner update(String resourceGroupName, String monitorName, Tags tagsParameter) { + return updateAsync(resourceGroupName, monitorName, tagsParameter).block(); + } + + /** + * Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param tagsParameter Request body that only contains the new Tags field. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sAP monitor info on Azure (ARM properties and SAP monitor properties) along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String monitorName, Tags tagsParameter, Context context) { + return updateWithResponseAsync(resourceGroupName, monitorName, tagsParameter, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 from the List SAP monitors 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 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 from the List SAP monitors 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)); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 from the List SAP monitors 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 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 from the List SAP monitors 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)); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/MonitorsImpl.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/MonitorsImpl.java new file mode 100644 index 000000000000..f5fd0c82586d --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/MonitorsImpl.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.workloads.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.workloads.fluent.MonitorsClient; +import com.azure.resourcemanager.workloads.fluent.models.MonitorInner; +import com.azure.resourcemanager.workloads.fluent.models.OperationStatusResultInner; +import com.azure.resourcemanager.workloads.models.Monitor; +import com.azure.resourcemanager.workloads.models.Monitors; +import com.azure.resourcemanager.workloads.models.OperationStatusResult; + +public final class MonitorsImpl implements Monitors { + private static final ClientLogger LOGGER = new ClientLogger(MonitorsImpl.class); + + private final MonitorsClient innerClient; + + private final com.azure.resourcemanager.workloads.WorkloadsManager serviceManager; + + public MonitorsImpl( + MonitorsClient innerClient, com.azure.resourcemanager.workloads.WorkloadsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new MonitorImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new MonitorImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new MonitorImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new MonitorImpl(inner1, this.manager())); + } + + public Monitor getByResourceGroup(String resourceGroupName, String monitorName) { + MonitorInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, monitorName); + if (inner != null) { + return new MonitorImpl(inner, this.manager()); + } else { + return null; + } + } + + 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 MonitorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OperationStatusResult deleteByResourceGroup(String resourceGroupName, String monitorName) { + OperationStatusResultInner inner = this.serviceClient().delete(resourceGroupName, monitorName); + if (inner != null) { + return new OperationStatusResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public OperationStatusResult delete(String resourceGroupName, String monitorName, Context context) { + OperationStatusResultInner inner = this.serviceClient().delete(resourceGroupName, monitorName, context); + if (inner != null) { + return new OperationStatusResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Monitor 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); + } + + public OperationStatusResult 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))); + } + return this.delete(resourceGroupName, monitorName, Context.NONE); + } + + public OperationStatusResult 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))); + } + return this.delete(resourceGroupName, monitorName, context); + } + + private MonitorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.workloads.WorkloadsManager manager() { + return this.serviceManager; + } + + public MonitorImpl define(String name) { + return new MonitorImpl(name, this.manager()); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationImpl.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationImpl.java new file mode 100644 index 000000000000..e2f2f001b0a6 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/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.workloads.implementation; + +import com.azure.resourcemanager.workloads.fluent.models.OperationInner; +import com.azure.resourcemanager.workloads.models.ActionType; +import com.azure.resourcemanager.workloads.models.Operation; +import com.azure.resourcemanager.workloads.models.OperationDisplay; +import com.azure.resourcemanager.workloads.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.workloads.WorkloadsManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.workloads.WorkloadsManager 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.workloads.WorkloadsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationStatusResultImpl.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationStatusResultImpl.java new file mode 100644 index 000000000000..da6cc885386a --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationStatusResultImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.workloads.fluent.models.OperationStatusResultInner; +import com.azure.resourcemanager.workloads.models.OperationStatusResult; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class OperationStatusResultImpl implements OperationStatusResult { + private OperationStatusResultInner innerObject; + + private final com.azure.resourcemanager.workloads.WorkloadsManager serviceManager; + + OperationStatusResultImpl( + OperationStatusResultInner innerObject, com.azure.resourcemanager.workloads.WorkloadsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String status() { + return this.innerModel().status(); + } + + public Float percentComplete() { + return this.innerModel().percentComplete(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public List operations() { + List inner = this.innerModel().operations(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new OperationStatusResultImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public ManagementError error() { + return this.innerModel().error(); + } + + public OperationStatusResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.workloads.WorkloadsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationsClientImpl.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..e03d98681708 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationsClientImpl.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.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.workloads.fluent.OperationsClient; +import com.azure.resourcemanager.workloads.fluent.models.OperationInner; +import com.azure.resourcemanager.workloads.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 WorkloadsClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(WorkloadsClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for WorkloadsClientOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "WorkloadsClientOpera") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Workloads/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); + } + + /** + * Lists all the available API operations under this PR. + * + * @throws ManagementException 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())); + } + + /** + * Lists all the available API operations under this PR. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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)); + } + + /** + * Lists all the available API operations under this PR. + * + * @throws ManagementException 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)); + } + + /** + * Lists all the available API operations under this PR. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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)); + } + + /** + * Lists all the available API operations under this PR. + * + * @throws ManagementException 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()); + } + + /** + * Lists all the available API operations under this PR. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 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 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/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationsImpl.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/OperationsImpl.java new file mode 100644 index 000000000000..7132fc6ca9c3 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/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.workloads.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.workloads.fluent.OperationsClient; +import com.azure.resourcemanager.workloads.fluent.models.OperationInner; +import com.azure.resourcemanager.workloads.models.Operation; +import com.azure.resourcemanager.workloads.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.workloads.WorkloadsManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.workloads.WorkloadsManager 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.workloads.WorkloadsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/ProviderInstanceImpl.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/ProviderInstanceImpl.java new file mode 100644 index 000000000000..a0a27a932211 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/ProviderInstanceImpl.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.workloads.fluent.models.ProviderInstanceInner; +import com.azure.resourcemanager.workloads.models.ProviderInstance; +import com.azure.resourcemanager.workloads.models.ProviderInstancePropertiesErrors; +import com.azure.resourcemanager.workloads.models.ProviderSpecificProperties; +import com.azure.resourcemanager.workloads.models.WorkloadMonitorProvisioningState; + +public final class ProviderInstanceImpl implements ProviderInstance, ProviderInstance.Definition { + private ProviderInstanceInner innerObject; + + private final com.azure.resourcemanager.workloads.WorkloadsManager serviceManager; + + ProviderInstanceImpl( + ProviderInstanceInner innerObject, com.azure.resourcemanager.workloads.WorkloadsManager 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 WorkloadMonitorProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public ProviderInstancePropertiesErrors errors() { + return this.innerModel().errors(); + } + + public ProviderSpecificProperties providerSettings() { + return this.innerModel().providerSettings(); + } + + public ProviderInstanceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.workloads.WorkloadsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String monitorName; + + private String providerInstanceName; + + public ProviderInstanceImpl withExistingMonitor(String resourceGroupName, String monitorName) { + this.resourceGroupName = resourceGroupName; + this.monitorName = monitorName; + return this; + } + + public ProviderInstance create() { + this.innerObject = + serviceManager + .serviceClient() + .getProviderInstances() + .create(resourceGroupName, monitorName, providerInstanceName, this.innerModel(), Context.NONE); + return this; + } + + public ProviderInstance create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProviderInstances() + .create(resourceGroupName, monitorName, providerInstanceName, this.innerModel(), context); + return this; + } + + ProviderInstanceImpl(String name, com.azure.resourcemanager.workloads.WorkloadsManager serviceManager) { + this.innerObject = new ProviderInstanceInner(); + this.serviceManager = serviceManager; + this.providerInstanceName = name; + } + + public ProviderInstance refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getProviderInstances() + .getWithResponse(resourceGroupName, monitorName, providerInstanceName, Context.NONE) + .getValue(); + return this; + } + + public ProviderInstance refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProviderInstances() + .getWithResponse(resourceGroupName, monitorName, providerInstanceName, context) + .getValue(); + return this; + } + + public ProviderInstanceImpl withProviderSettings(ProviderSpecificProperties providerSettings) { + this.innerModel().withProviderSettings(providerSettings); + return this; + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/ProviderInstancesClientImpl.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/ProviderInstancesClientImpl.java new file mode 100644 index 000000000000..a4ac004288a8 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/ProviderInstancesClientImpl.java @@ -0,0 +1,1177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.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.workloads.fluent.ProviderInstancesClient; +import com.azure.resourcemanager.workloads.fluent.models.OperationStatusResultInner; +import com.azure.resourcemanager.workloads.fluent.models.ProviderInstanceInner; +import com.azure.resourcemanager.workloads.models.ProviderInstanceListResult; +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 ProviderInstancesClient. */ +public final class ProviderInstancesClientImpl implements ProviderInstancesClient { + /** The proxy service used to perform REST calls. */ + private final ProviderInstancesService service; + + /** The service client containing this operation class. */ + private final WorkloadsClientImpl client; + + /** + * Initializes an instance of ProviderInstancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProviderInstancesClientImpl(WorkloadsClientImpl client) { + this.service = + RestProxy.create(ProviderInstancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for WorkloadsClientProviderInstances to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "WorkloadsClientProvi") + private interface ProviderInstancesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors" + + "/{monitorName}/providerInstances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @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/Microsoft.Workloads/monitors" + + "/{monitorName}/providerInstances/{providerInstanceName}") + @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("providerInstanceName") String providerInstanceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors" + + "/{monitorName}/providerInstances/{providerInstanceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("providerInstanceName") String providerInstanceName, + @BodyParam("application/json") ProviderInstanceInner providerInstanceParameter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors" + + "/{monitorName}/providerInstances/{providerInstanceName}") + @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("providerInstanceName") String providerInstanceName, + @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); + } + + /** + * Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each + * provider instances. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 list of provider instances in the specified SAP monitor along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + 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 + .list( + 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())); + } + + /** + * Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each + * provider instances. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 list of provider instances in the specified SAP monitor along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + 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 + .list( + 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)); + } + + /** + * Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each + * provider instances. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 list of provider instances in the specified SAP monitor as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String monitorName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, monitorName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each + * provider instances. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 list of provider instances in the specified SAP monitor as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String monitorName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, monitorName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each + * provider instances. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 list of provider instances in the specified SAP monitor as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String monitorName) { + return new PagedIterable<>(listAsync(resourceGroupName, monitorName)); + } + + /** + * Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each + * provider instances. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 list of provider instances in the specified SAP monitor as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String monitorName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, monitorName, context)); + } + + /** + * Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a provider instance for the specified subscription, resource group, Monitor name, and + * resource name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String providerInstanceName) { + 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 (providerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter providerInstanceName 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, + providerInstanceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a provider instance for the specified subscription, resource group, Monitor name, and + * resource name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String providerInstanceName, 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 (providerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter providerInstanceName 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, + providerInstanceName, + accept, + context); + } + + /** + * Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a provider instance for the specified subscription, resource group, Monitor name, and + * resource name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String monitorName, String providerInstanceName) { + return getWithResponseAsync(resourceGroupName, monitorName, providerInstanceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a provider instance for the specified subscription, resource group, Monitor name, and + * resource name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProviderInstanceInner get(String resourceGroupName, String monitorName, String providerInstanceName) { + return getAsync(resourceGroupName, monitorName, providerInstanceName).block(); + } + + /** + * Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a provider instance for the specified subscription, resource group, Monitor name, and + * resource name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String monitorName, String providerInstanceName, Context context) { + return getWithResponseAsync(resourceGroupName, monitorName, providerInstanceName, context).block(); + } + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provider instance associated with monitor along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter) { + 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 (providerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter providerInstanceName is required and cannot be null.")); + } + if (providerInstanceParameter == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter providerInstanceParameter is required and cannot be null.")); + } else { + providerInstanceParameter.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + providerInstanceName, + providerInstanceParameter, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provider instance associated with monitor along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter, + 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 (providerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter providerInstanceName is required and cannot be null.")); + } + if (providerInstanceParameter == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter providerInstanceParameter is required and cannot be null.")); + } else { + providerInstanceParameter.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + providerInstanceName, + providerInstanceParameter, + accept, + context); + } + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 provider instance associated with monitor. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ProviderInstanceInner> beginCreateAsync( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ProviderInstanceInner.class, + ProviderInstanceInner.class, + this.client.getContext()); + } + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 provider instance associated with monitor. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ProviderInstanceInner> beginCreateAsync( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync( + resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ProviderInstanceInner.class, ProviderInstanceInner.class, context); + } + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 provider instance associated with monitor. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProviderInstanceInner> beginCreate( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter) { + return beginCreateAsync(resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter) + .getSyncPoller(); + } + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 provider instance associated with monitor. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProviderInstanceInner> beginCreate( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter, + Context context) { + return beginCreateAsync( + resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter, context) + .getSyncPoller(); + } + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provider instance associated with monitor on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter) { + return beginCreateAsync(resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provider instance associated with monitor on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter, + Context context) { + return beginCreateAsync( + resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provider instance associated with monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProviderInstanceInner create( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter) { + return createAsync(resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter).block(); + } + + /** + * Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param providerInstanceParameter Request body representing a provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a provider instance associated with monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProviderInstanceInner create( + String resourceGroupName, + String monitorName, + String providerInstanceName, + ProviderInstanceInner providerInstanceParameter, + Context context) { + return createAsync(resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter, context) + .block(); + } + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String monitorName, String providerInstanceName) { + 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 (providerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter providerInstanceName 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, + providerInstanceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String monitorName, String providerInstanceName, 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 (providerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter providerInstanceName 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, + providerInstanceName, + accept, + context); + } + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OperationStatusResultInner> beginDeleteAsync( + String resourceGroupName, String monitorName, String providerInstanceName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, monitorName, providerInstanceName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OperationStatusResultInner.class, + OperationStatusResultInner.class, + this.client.getContext()); + } + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OperationStatusResultInner> beginDeleteAsync( + String resourceGroupName, String monitorName, String providerInstanceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, monitorName, providerInstanceName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OperationStatusResultInner.class, + OperationStatusResultInner.class, + context); + } + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OperationStatusResultInner> beginDelete( + String resourceGroupName, String monitorName, String providerInstanceName) { + return beginDeleteAsync(resourceGroupName, monitorName, providerInstanceName).getSyncPoller(); + } + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OperationStatusResultInner> beginDelete( + String resourceGroupName, String monitorName, String providerInstanceName, Context context) { + return beginDeleteAsync(resourceGroupName, monitorName, providerInstanceName, context).getSyncPoller(); + } + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String monitorName, String providerInstanceName) { + return beginDeleteAsync(resourceGroupName, monitorName, providerInstanceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String monitorName, String providerInstanceName, Context context) { + return beginDeleteAsync(resourceGroupName, monitorName, providerInstanceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusResultInner delete( + String resourceGroupName, String monitorName, String providerInstanceName) { + return deleteAsync(resourceGroupName, monitorName, providerInstanceName).block(); + } + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusResultInner delete( + String resourceGroupName, String monitorName, String providerInstanceName, Context context) { + return deleteAsync(resourceGroupName, monitorName, providerInstanceName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 from the List provider instances 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 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 from the List provider instances 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/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/ProviderInstancesImpl.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/ProviderInstancesImpl.java new file mode 100644 index 000000000000..8b5d9d2d244f --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/ProviderInstancesImpl.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.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.workloads.fluent.ProviderInstancesClient; +import com.azure.resourcemanager.workloads.fluent.models.OperationStatusResultInner; +import com.azure.resourcemanager.workloads.fluent.models.ProviderInstanceInner; +import com.azure.resourcemanager.workloads.models.OperationStatusResult; +import com.azure.resourcemanager.workloads.models.ProviderInstance; +import com.azure.resourcemanager.workloads.models.ProviderInstances; + +public final class ProviderInstancesImpl implements ProviderInstances { + private static final ClientLogger LOGGER = new ClientLogger(ProviderInstancesImpl.class); + + private final ProviderInstancesClient innerClient; + + private final com.azure.resourcemanager.workloads.WorkloadsManager serviceManager; + + public ProviderInstancesImpl( + ProviderInstancesClient innerClient, com.azure.resourcemanager.workloads.WorkloadsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String monitorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, monitorName); + return Utils.mapPage(inner, inner1 -> new ProviderInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, monitorName, context); + return Utils.mapPage(inner, inner1 -> new ProviderInstanceImpl(inner1, this.manager())); + } + + public ProviderInstance get(String resourceGroupName, String monitorName, String providerInstanceName) { + ProviderInstanceInner inner = this.serviceClient().get(resourceGroupName, monitorName, providerInstanceName); + if (inner != null) { + return new ProviderInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String monitorName, String providerInstanceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, monitorName, providerInstanceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProviderInstanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OperationStatusResult delete(String resourceGroupName, String monitorName, String providerInstanceName) { + OperationStatusResultInner inner = + this.serviceClient().delete(resourceGroupName, monitorName, providerInstanceName); + if (inner != null) { + return new OperationStatusResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public OperationStatusResult delete( + String resourceGroupName, String monitorName, String providerInstanceName, Context context) { + OperationStatusResultInner inner = + this.serviceClient().delete(resourceGroupName, monitorName, providerInstanceName, context); + if (inner != null) { + return new OperationStatusResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ProviderInstance 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 providerInstanceName = Utils.getValueFromIdByName(id, "providerInstances"); + if (providerInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'providerInstances'.", id))); + } + return this.getWithResponse(resourceGroupName, monitorName, providerInstanceName, 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 providerInstanceName = Utils.getValueFromIdByName(id, "providerInstances"); + if (providerInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'providerInstances'.", id))); + } + return this.getWithResponse(resourceGroupName, monitorName, providerInstanceName, context); + } + + public OperationStatusResult 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 providerInstanceName = Utils.getValueFromIdByName(id, "providerInstances"); + if (providerInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'providerInstances'.", id))); + } + return this.delete(resourceGroupName, monitorName, providerInstanceName, Context.NONE); + } + + public OperationStatusResult 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 providerInstanceName = Utils.getValueFromIdByName(id, "providerInstances"); + if (providerInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'providerInstances'.", id))); + } + return this.delete(resourceGroupName, monitorName, providerInstanceName, context); + } + + private ProviderInstancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.workloads.WorkloadsManager manager() { + return this.serviceManager; + } + + public ProviderInstanceImpl define(String name) { + return new ProviderInstanceImpl(name, this.manager()); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/Utils.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/Utils.java new file mode 100644 index 000000000000..10d30687e9a3 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/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.workloads.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/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/WorkloadsClientBuilder.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/WorkloadsClientBuilder.java new file mode 100644 index 000000000000..1c08f50a2899 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/WorkloadsClientBuilder.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.workloads.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 WorkloadsClientImpl type. */ +@ServiceClientBuilder(serviceClients = {WorkloadsClientImpl.class}) +public final class WorkloadsClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the WorkloadsClientBuilder. + */ + public WorkloadsClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the WorkloadsClientBuilder. + */ + public WorkloadsClientBuilder 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 WorkloadsClientBuilder. + */ + public WorkloadsClientBuilder 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 WorkloadsClientBuilder. + */ + public WorkloadsClientBuilder 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 WorkloadsClientBuilder. + */ + public WorkloadsClientBuilder 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 WorkloadsClientBuilder. + */ + public WorkloadsClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of WorkloadsClientImpl with the provided parameters. + * + * @return an instance of WorkloadsClientImpl. + */ + public WorkloadsClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (pipeline == null) { + this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + WorkloadsClientImpl client = + new WorkloadsClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/WorkloadsClientImpl.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/WorkloadsClientImpl.java new file mode 100644 index 000000000000..9364313ca194 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/WorkloadsClientImpl.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.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.workloads.fluent.MonitorsClient; +import com.azure.resourcemanager.workloads.fluent.OperationsClient; +import com.azure.resourcemanager.workloads.fluent.ProviderInstancesClient; +import com.azure.resourcemanager.workloads.fluent.WorkloadsClient; +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 WorkloadsClientImpl type. */ +@ServiceClient(builder = WorkloadsClientBuilder.class) +public final class WorkloadsClientImpl implements WorkloadsClient { + /** 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 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 ProviderInstancesClient object to access its operations. */ + private final ProviderInstancesClient providerInstances; + + /** + * Gets the ProviderInstancesClient object to access its operations. + * + * @return the ProviderInstancesClient object. + */ + public ProviderInstancesClient getProviderInstances() { + return this.providerInstances; + } + + /** + * Initializes an instance of WorkloadsClient 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. + */ + WorkloadsClientImpl( + 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 = "2021-12-01-preview"; + this.operations = new OperationsClientImpl(this); + this.monitors = new MonitorsClientImpl(this); + this.providerInstances = new ProviderInstancesClientImpl(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(WorkloadsClientImpl.class); +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/package-info.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/package-info.java new file mode 100644 index 000000000000..2c13fddfb2d9 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for WorkloadsClient. Workloads client provides access to various workload + * operations. + */ +package com.azure.resourcemanager.workloads.implementation; diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ActionType.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ActionType.java new file mode 100644 index 000000000000..d0660a2e0a2c --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ActionType.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ActionType. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * 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/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/DB2ProviderInstanceProperties.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/DB2ProviderInstanceProperties.java new file mode 100644 index 000000000000..53972ac4fedd --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/DB2ProviderInstanceProperties.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Gets or sets the DB2 provider properties. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "providerType") +@JsonTypeName("Db2") +@Fluent +public final class DB2ProviderInstanceProperties extends ProviderSpecificProperties { + /* + * Gets or sets the target virtual machine name. + */ + @JsonProperty(value = "hostname") + private String hostname; + + /* + * Gets or sets the db2 database name. + */ + @JsonProperty(value = "dbName") + private String dbName; + + /* + * Gets or sets the db2 database sql port. + */ + @JsonProperty(value = "dbPort") + private String dbPort; + + /* + * Gets or sets the db2 database user name. + */ + @JsonProperty(value = "dbUsername") + private String dbUsername; + + /* + * Gets or sets the db2 database password. + */ + @JsonProperty(value = "dbPassword") + private String dbPassword; + + /* + * Gets or sets the key vault URI to secret with the database password. + */ + @JsonProperty(value = "dbPasswordUri") + private String dbPasswordUri; + + /* + * Gets or sets the SAP System Identifier + */ + @JsonProperty(value = "sapSid") + private String sapSid; + + /** + * Get the hostname property: Gets or sets the target virtual machine name. + * + * @return the hostname value. + */ + public String hostname() { + return this.hostname; + } + + /** + * Set the hostname property: Gets or sets the target virtual machine name. + * + * @param hostname the hostname value to set. + * @return the DB2ProviderInstanceProperties object itself. + */ + public DB2ProviderInstanceProperties withHostname(String hostname) { + this.hostname = hostname; + return this; + } + + /** + * Get the dbName property: Gets or sets the db2 database name. + * + * @return the dbName value. + */ + public String dbName() { + return this.dbName; + } + + /** + * Set the dbName property: Gets or sets the db2 database name. + * + * @param dbName the dbName value to set. + * @return the DB2ProviderInstanceProperties object itself. + */ + public DB2ProviderInstanceProperties withDbName(String dbName) { + this.dbName = dbName; + return this; + } + + /** + * Get the dbPort property: Gets or sets the db2 database sql port. + * + * @return the dbPort value. + */ + public String dbPort() { + return this.dbPort; + } + + /** + * Set the dbPort property: Gets or sets the db2 database sql port. + * + * @param dbPort the dbPort value to set. + * @return the DB2ProviderInstanceProperties object itself. + */ + public DB2ProviderInstanceProperties withDbPort(String dbPort) { + this.dbPort = dbPort; + return this; + } + + /** + * Get the dbUsername property: Gets or sets the db2 database user name. + * + * @return the dbUsername value. + */ + public String dbUsername() { + return this.dbUsername; + } + + /** + * Set the dbUsername property: Gets or sets the db2 database user name. + * + * @param dbUsername the dbUsername value to set. + * @return the DB2ProviderInstanceProperties object itself. + */ + public DB2ProviderInstanceProperties withDbUsername(String dbUsername) { + this.dbUsername = dbUsername; + return this; + } + + /** + * Get the dbPassword property: Gets or sets the db2 database password. + * + * @return the dbPassword value. + */ + public String dbPassword() { + return this.dbPassword; + } + + /** + * Set the dbPassword property: Gets or sets the db2 database password. + * + * @param dbPassword the dbPassword value to set. + * @return the DB2ProviderInstanceProperties object itself. + */ + public DB2ProviderInstanceProperties withDbPassword(String dbPassword) { + this.dbPassword = dbPassword; + return this; + } + + /** + * Get the dbPasswordUri property: Gets or sets the key vault URI to secret with the database password. + * + * @return the dbPasswordUri value. + */ + public String dbPasswordUri() { + return this.dbPasswordUri; + } + + /** + * Set the dbPasswordUri property: Gets or sets the key vault URI to secret with the database password. + * + * @param dbPasswordUri the dbPasswordUri value to set. + * @return the DB2ProviderInstanceProperties object itself. + */ + public DB2ProviderInstanceProperties withDbPasswordUri(String dbPasswordUri) { + this.dbPasswordUri = dbPasswordUri; + return this; + } + + /** + * Get the sapSid property: Gets or sets the SAP System Identifier. + * + * @return the sapSid value. + */ + public String sapSid() { + return this.sapSid; + } + + /** + * Set the sapSid property: Gets or sets the SAP System Identifier. + * + * @param sapSid the sapSid value to set. + * @return the DB2ProviderInstanceProperties object itself. + */ + public DB2ProviderInstanceProperties withSapSid(String sapSid) { + this.sapSid = sapSid; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Error.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Error.java new file mode 100644 index 000000000000..d67b8605e86c --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Error.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.workloads.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Standard error object. */ +@Immutable +public class Error { + /* + * Server-defined set of error codes. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /* + * Human-readable representation of the error. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /* + * Target of the error. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /* + * Array of details about specific errors that led to this reported error. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private List details; + + /* + * Object containing more specific information than the current object + * about the error. + */ + @JsonProperty(value = "innerError", access = JsonProperty.Access.WRITE_ONLY) + private ErrorInnerError innerError; + + /** + * Get the code property: Server-defined set of error codes. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the message property: Human-readable representation of the error. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the target property: Target of the error. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Get the details property: Array of details about specific errors that led to this reported error. + * + * @return the details value. + */ + public List details() { + return this.details; + } + + /** + * Get the innerError property: Object containing more specific information than the current object about the error. + * + * @return the innerError value. + */ + public ErrorInnerError innerError() { + return this.innerError; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (details() != null) { + details().forEach(e -> e.validate()); + } + if (innerError() != null) { + innerError().validate(); + } + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ErrorInnerError.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ErrorInnerError.java new file mode 100644 index 000000000000..9cf5260c3e42 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ErrorInnerError.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Object containing more specific information than the current object about the error. */ +@Fluent +public final class ErrorInnerError { + /* + * Standard error object. + */ + @JsonProperty(value = "innerError") + private Error innerError; + + /** + * Get the innerError property: Standard error object. + * + * @return the innerError value. + */ + public Error innerError() { + return this.innerError; + } + + /** + * Set the innerError property: Standard error object. + * + * @param innerError the innerError value to set. + * @return the ErrorInnerError object itself. + */ + public ErrorInnerError withInnerError(Error innerError) { + this.innerError = innerError; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerError() != null) { + innerError().validate(); + } + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/HanaDbProviderInstanceProperties.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/HanaDbProviderInstanceProperties.java new file mode 100644 index 000000000000..8815a4c7022d --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/HanaDbProviderInstanceProperties.java @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Gets or sets the provider properties. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "providerType") +@JsonTypeName("SapHana") +@Fluent +public final class HanaDbProviderInstanceProperties extends ProviderSpecificProperties { + /* + * Gets or sets the target virtual machine size. + */ + @JsonProperty(value = "hostname") + private String hostname; + + /* + * Gets or sets the hana database name. + */ + @JsonProperty(value = "dbName") + private String dbName; + + /* + * Gets or sets the database sql port. + */ + @JsonProperty(value = "sqlPort") + private String sqlPort; + + /* + * Gets or sets the database instance number. + */ + @JsonProperty(value = "instanceNumber") + private String instanceNumber; + + /* + * Gets or sets the database user name. + */ + @JsonProperty(value = "dbUsername") + private String dbUsername; + + /* + * Gets or sets the database password. + */ + @JsonProperty(value = "dbPassword") + private String dbPassword; + + /* + * Gets or sets the key vault URI to secret with the database password. + */ + @JsonProperty(value = "dbPasswordUri") + private String dbPasswordUri; + + /* + * Gets or sets the blob URI to SSL certificate for the DB. + */ + @JsonProperty(value = "dbSslCertificateUri") + private String dbSslCertificateUri; + + /* + * Gets or sets the hostname(s) in the SSL certificate. + */ + @JsonProperty(value = "sslHostNameInCertificate") + private String sslHostnameInCertificate; + + /** + * Get the hostname property: Gets or sets the target virtual machine size. + * + * @return the hostname value. + */ + public String hostname() { + return this.hostname; + } + + /** + * Set the hostname property: Gets or sets the target virtual machine size. + * + * @param hostname the hostname value to set. + * @return the HanaDbProviderInstanceProperties object itself. + */ + public HanaDbProviderInstanceProperties withHostname(String hostname) { + this.hostname = hostname; + return this; + } + + /** + * Get the dbName property: Gets or sets the hana database name. + * + * @return the dbName value. + */ + public String dbName() { + return this.dbName; + } + + /** + * Set the dbName property: Gets or sets the hana database name. + * + * @param dbName the dbName value to set. + * @return the HanaDbProviderInstanceProperties object itself. + */ + public HanaDbProviderInstanceProperties withDbName(String dbName) { + this.dbName = dbName; + return this; + } + + /** + * Get the sqlPort property: Gets or sets the database sql port. + * + * @return the sqlPort value. + */ + public String sqlPort() { + return this.sqlPort; + } + + /** + * Set the sqlPort property: Gets or sets the database sql port. + * + * @param sqlPort the sqlPort value to set. + * @return the HanaDbProviderInstanceProperties object itself. + */ + public HanaDbProviderInstanceProperties withSqlPort(String sqlPort) { + this.sqlPort = sqlPort; + return this; + } + + /** + * Get the instanceNumber property: Gets or sets the database instance number. + * + * @return the instanceNumber value. + */ + public String instanceNumber() { + return this.instanceNumber; + } + + /** + * Set the instanceNumber property: Gets or sets the database instance number. + * + * @param instanceNumber the instanceNumber value to set. + * @return the HanaDbProviderInstanceProperties object itself. + */ + public HanaDbProviderInstanceProperties withInstanceNumber(String instanceNumber) { + this.instanceNumber = instanceNumber; + return this; + } + + /** + * Get the dbUsername property: Gets or sets the database user name. + * + * @return the dbUsername value. + */ + public String dbUsername() { + return this.dbUsername; + } + + /** + * Set the dbUsername property: Gets or sets the database user name. + * + * @param dbUsername the dbUsername value to set. + * @return the HanaDbProviderInstanceProperties object itself. + */ + public HanaDbProviderInstanceProperties withDbUsername(String dbUsername) { + this.dbUsername = dbUsername; + return this; + } + + /** + * Get the dbPassword property: Gets or sets the database password. + * + * @return the dbPassword value. + */ + public String dbPassword() { + return this.dbPassword; + } + + /** + * Set the dbPassword property: Gets or sets the database password. + * + * @param dbPassword the dbPassword value to set. + * @return the HanaDbProviderInstanceProperties object itself. + */ + public HanaDbProviderInstanceProperties withDbPassword(String dbPassword) { + this.dbPassword = dbPassword; + return this; + } + + /** + * Get the dbPasswordUri property: Gets or sets the key vault URI to secret with the database password. + * + * @return the dbPasswordUri value. + */ + public String dbPasswordUri() { + return this.dbPasswordUri; + } + + /** + * Set the dbPasswordUri property: Gets or sets the key vault URI to secret with the database password. + * + * @param dbPasswordUri the dbPasswordUri value to set. + * @return the HanaDbProviderInstanceProperties object itself. + */ + public HanaDbProviderInstanceProperties withDbPasswordUri(String dbPasswordUri) { + this.dbPasswordUri = dbPasswordUri; + return this; + } + + /** + * Get the dbSslCertificateUri property: Gets or sets the blob URI to SSL certificate for the DB. + * + * @return the dbSslCertificateUri value. + */ + public String dbSslCertificateUri() { + return this.dbSslCertificateUri; + } + + /** + * Set the dbSslCertificateUri property: Gets or sets the blob URI to SSL certificate for the DB. + * + * @param dbSslCertificateUri the dbSslCertificateUri value to set. + * @return the HanaDbProviderInstanceProperties object itself. + */ + public HanaDbProviderInstanceProperties withDbSslCertificateUri(String dbSslCertificateUri) { + this.dbSslCertificateUri = dbSslCertificateUri; + return this; + } + + /** + * Get the sslHostnameInCertificate property: Gets or sets the hostname(s) in the SSL certificate. + * + * @return the sslHostnameInCertificate value. + */ + public String sslHostnameInCertificate() { + return this.sslHostnameInCertificate; + } + + /** + * Set the sslHostnameInCertificate property: Gets or sets the hostname(s) in the SSL certificate. + * + * @param sslHostnameInCertificate the sslHostnameInCertificate value to set. + * @return the HanaDbProviderInstanceProperties object itself. + */ + public HanaDbProviderInstanceProperties withSslHostnameInCertificate(String sslHostnameInCertificate) { + this.sslHostnameInCertificate = sslHostnameInCertificate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ManagedRGConfiguration.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ManagedRGConfiguration.java new file mode 100644 index 000000000000..4cc347a8781f --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ManagedRGConfiguration.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.workloads.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Managed resource group configuration. */ +@Fluent +public final class ManagedRGConfiguration { + /* + * Managed resource group name + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: Managed resource group name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Managed resource group name. + * + * @param name the name value to set. + * @return the ManagedRGConfiguration object itself. + */ + public ManagedRGConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Monitor.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Monitor.java new file mode 100644 index 000000000000..7c0ecf25eb40 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Monitor.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.workloads.fluent.models.MonitorInner; +import java.util.Map; + +/** An immutable client-side representation of Monitor. */ +public interface Monitor { + /** + * 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 provisioningState property: State of provisioning of the monitor. + * + * @return the provisioningState value. + */ + WorkloadMonitorProvisioningState provisioningState(); + + /** + * Gets the errors property: Defines the SAP monitor errors. + * + * @return the errors value. + */ + MonitorPropertiesErrors errors(); + + /** + * Gets the appLocation property: The monitor resources will be deployed in the monitoring region. The subnet region + * should be same as the monitoring region. + * + * @return the appLocation value. + */ + String appLocation(); + + /** + * Gets the routingPreference property: Sets the routing preference of the monitor. By default only RFC1918 traffic + * is routed to the customer VNET. + * + * @return the routingPreference value. + */ + RoutingPreference routingPreference(); + + /** + * Gets the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @return the managedResourceGroupConfiguration value. + */ + ManagedRGConfiguration managedResourceGroupConfiguration(); + + /** + * Gets the logAnalyticsWorkspaceArmId property: The ARM ID of the Log Analytics Workspace that is used for + * monitoring. + * + * @return the logAnalyticsWorkspaceArmId value. + */ + String logAnalyticsWorkspaceArmId(); + + /** + * Gets the monitorSubnet property: The subnet which the SAP monitor will be deployed in. + * + * @return the monitorSubnet value. + */ + String monitorSubnet(); + + /** + * Gets the msiArmId property: The ARM ID of the MSI used for monitoring. + * + * @return the msiArmId value. + */ + String msiArmId(); + + /** + * 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.workloads.fluent.models.MonitorInner object. + * + * @return the inner object. + */ + MonitorInner innerModel(); + + /** The entirety of the Monitor definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Monitor definition stages. */ + interface DefinitionStages { + /** The first stage of the Monitor definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Monitor 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 Monitor 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 Monitor 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.WithAppLocation, + DefinitionStages.WithRoutingPreference, + DefinitionStages.WithManagedResourceGroupConfiguration, + DefinitionStages.WithLogAnalyticsWorkspaceArmId, + DefinitionStages.WithMonitorSubnet { + /** + * Executes the create request. + * + * @return the created resource. + */ + Monitor create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Monitor create(Context context); + } + /** The stage of the Monitor 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 Monitor definition allowing to specify appLocation. */ + interface WithAppLocation { + /** + * Specifies the appLocation property: The monitor resources will be deployed in the monitoring region. The + * subnet region should be same as the monitoring region.. + * + * @param appLocation The monitor resources will be deployed in the monitoring region. The subnet region + * should be same as the monitoring region. + * @return the next definition stage. + */ + WithCreate withAppLocation(String appLocation); + } + /** The stage of the Monitor definition allowing to specify routingPreference. */ + interface WithRoutingPreference { + /** + * Specifies the routingPreference property: Sets the routing preference of the monitor. By default only + * RFC1918 traffic is routed to the customer VNET.. + * + * @param routingPreference Sets the routing preference of the monitor. By default only RFC1918 traffic is + * routed to the customer VNET. + * @return the next definition stage. + */ + WithCreate withRoutingPreference(RoutingPreference routingPreference); + } + /** The stage of the Monitor definition allowing to specify managedResourceGroupConfiguration. */ + interface WithManagedResourceGroupConfiguration { + /** + * Specifies the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @param managedResourceGroupConfiguration Managed resource group configuration. + * @return the next definition stage. + */ + WithCreate withManagedResourceGroupConfiguration(ManagedRGConfiguration managedResourceGroupConfiguration); + } + /** The stage of the Monitor definition allowing to specify logAnalyticsWorkspaceArmId. */ + interface WithLogAnalyticsWorkspaceArmId { + /** + * Specifies the logAnalyticsWorkspaceArmId property: The ARM ID of the Log Analytics Workspace that is used + * for monitoring.. + * + * @param logAnalyticsWorkspaceArmId The ARM ID of the Log Analytics Workspace that is used for monitoring. + * @return the next definition stage. + */ + WithCreate withLogAnalyticsWorkspaceArmId(String logAnalyticsWorkspaceArmId); + } + /** The stage of the Monitor definition allowing to specify monitorSubnet. */ + interface WithMonitorSubnet { + /** + * Specifies the monitorSubnet property: The subnet which the SAP monitor will be deployed in. + * + * @param monitorSubnet The subnet which the SAP monitor will be deployed in. + * @return the next definition stage. + */ + WithCreate withMonitorSubnet(String monitorSubnet); + } + } + /** + * Begins update for the Monitor resource. + * + * @return the stage of resource update. + */ + Monitor.Update update(); + + /** The template for Monitor update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Monitor apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Monitor apply(Context context); + } + /** The Monitor update stages. */ + interface UpdateStages { + /** The stage of the Monitor update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Tags field of the resource.. + * + * @param tags Tags field of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Monitor refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Monitor refresh(Context context); +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/MonitorListResult.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/MonitorListResult.java new file mode 100644 index 000000000000..4a048c028ef6 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/MonitorListResult.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.workloads.fluent.models.MonitorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response from the List SAP monitors operation. */ +@Fluent +public final class MonitorListResult { + /* + * The list of SAP monitors. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to get the next set of SAP monitors. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of SAP monitors. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of SAP monitors. + * + * @param value the value value to set. + * @return the MonitorListResult object itself. + */ + public MonitorListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to get the next set of SAP monitors. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to get the next set of SAP monitors. + * + * @param nextLink the nextLink value to set. + * @return the MonitorListResult object itself. + */ + public MonitorListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/MonitorPropertiesErrors.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/MonitorPropertiesErrors.java new file mode 100644 index 000000000000..d0faf3b45b18 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/MonitorPropertiesErrors.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.workloads.models; + +import com.azure.core.annotation.Immutable; + +/** Defines the SAP monitor errors. */ +@Immutable +public final class MonitorPropertiesErrors extends Error { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Monitors.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Monitors.java new file mode 100644 index 000000000000..2f3b3c5fda90 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Monitors.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.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 { + /** + * Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP + * monitor. + * + * @throws com.azure.core.management.exception.ManagementException 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 SAP monitors in the specified subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP + * monitor. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SAP monitors in the specified subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets a list of SAP monitors in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SAP monitors in the specified resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of SAP monitors in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SAP monitors in the specified resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 properties of a SAP monitor for the specified subscription, resource group, and resource name. + */ + Monitor getByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP 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 properties of a SAP monitor for the specified subscription, resource group, and resource name along with + * {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String monitorName, Context context); + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 current status of an async operation. + */ + OperationStatusResult deleteByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP 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 the current status of an async operation. + */ + OperationStatusResult delete(String resourceGroupName, String monitorName, Context context); + + /** + * Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + * + * @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 properties of a SAP monitor for the specified subscription, resource group, and resource name along with + * {@link Response}. + */ + Monitor getById(String id); + + /** + * Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + * + * @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 properties of a SAP monitor for the specified subscription, resource group, and resource name along with + * {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + OperationStatusResult deleteById(String id); + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and monitor name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + OperationStatusResult deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Monitor resource. + * + * @param name resource name. + * @return the first stage of the new Monitor definition. + */ + Monitor.DefinitionStages.Blank define(String name); +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/MsSqlServerProviderInstanceProperties.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/MsSqlServerProviderInstanceProperties.java new file mode 100644 index 000000000000..25e7d2fb2ab4 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/MsSqlServerProviderInstanceProperties.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Gets or sets the SQL server provider properties. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "providerType") +@JsonTypeName("MsSqlServer") +@Fluent +public final class MsSqlServerProviderInstanceProperties extends ProviderSpecificProperties { + /* + * Gets or sets the SQL server host name. + */ + @JsonProperty(value = "hostname") + private String hostname; + + /* + * Gets or sets the database sql port. + */ + @JsonProperty(value = "dbPort") + private String dbPort; + + /* + * Gets or sets the database user name. + */ + @JsonProperty(value = "dbUsername") + private String dbUsername; + + /* + * Gets or sets the database password. + */ + @JsonProperty(value = "dbPassword") + private String dbPassword; + + /* + * Gets or sets the key vault URI to secret with the database password. + */ + @JsonProperty(value = "dbPasswordUri") + private String dbPasswordUri; + + /* + * Gets or sets the SAP System Identifier + */ + @JsonProperty(value = "sapSid") + private String sapSid; + + /** + * Get the hostname property: Gets or sets the SQL server host name. + * + * @return the hostname value. + */ + public String hostname() { + return this.hostname; + } + + /** + * Set the hostname property: Gets or sets the SQL server host name. + * + * @param hostname the hostname value to set. + * @return the MsSqlServerProviderInstanceProperties object itself. + */ + public MsSqlServerProviderInstanceProperties withHostname(String hostname) { + this.hostname = hostname; + return this; + } + + /** + * Get the dbPort property: Gets or sets the database sql port. + * + * @return the dbPort value. + */ + public String dbPort() { + return this.dbPort; + } + + /** + * Set the dbPort property: Gets or sets the database sql port. + * + * @param dbPort the dbPort value to set. + * @return the MsSqlServerProviderInstanceProperties object itself. + */ + public MsSqlServerProviderInstanceProperties withDbPort(String dbPort) { + this.dbPort = dbPort; + return this; + } + + /** + * Get the dbUsername property: Gets or sets the database user name. + * + * @return the dbUsername value. + */ + public String dbUsername() { + return this.dbUsername; + } + + /** + * Set the dbUsername property: Gets or sets the database user name. + * + * @param dbUsername the dbUsername value to set. + * @return the MsSqlServerProviderInstanceProperties object itself. + */ + public MsSqlServerProviderInstanceProperties withDbUsername(String dbUsername) { + this.dbUsername = dbUsername; + return this; + } + + /** + * Get the dbPassword property: Gets or sets the database password. + * + * @return the dbPassword value. + */ + public String dbPassword() { + return this.dbPassword; + } + + /** + * Set the dbPassword property: Gets or sets the database password. + * + * @param dbPassword the dbPassword value to set. + * @return the MsSqlServerProviderInstanceProperties object itself. + */ + public MsSqlServerProviderInstanceProperties withDbPassword(String dbPassword) { + this.dbPassword = dbPassword; + return this; + } + + /** + * Get the dbPasswordUri property: Gets or sets the key vault URI to secret with the database password. + * + * @return the dbPasswordUri value. + */ + public String dbPasswordUri() { + return this.dbPasswordUri; + } + + /** + * Set the dbPasswordUri property: Gets or sets the key vault URI to secret with the database password. + * + * @param dbPasswordUri the dbPasswordUri value to set. + * @return the MsSqlServerProviderInstanceProperties object itself. + */ + public MsSqlServerProviderInstanceProperties withDbPasswordUri(String dbPasswordUri) { + this.dbPasswordUri = dbPasswordUri; + return this; + } + + /** + * Get the sapSid property: Gets or sets the SAP System Identifier. + * + * @return the sapSid value. + */ + public String sapSid() { + return this.sapSid; + } + + /** + * Set the sapSid property: Gets or sets the SAP System Identifier. + * + * @param sapSid the sapSid value to set. + * @return the MsSqlServerProviderInstanceProperties object itself. + */ + public MsSqlServerProviderInstanceProperties withSapSid(String sapSid) { + this.sapSid = sapSid; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Operation.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Operation.java new file mode 100644 index 000000000000..c499b48bfa66 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/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.workloads.models; + +import com.azure.resourcemanager.workloads.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.workloads.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationDisplay.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationDisplay.java new file mode 100644 index 000000000000..2ae9e4f48b3f --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationDisplay.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.workloads.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; + + /** + * 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/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationListResult.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationListResult.java new file mode 100644 index 000000000000..ac6331db36e3 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationListResult.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.workloads.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.workloads.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; + + /** + * 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/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationStatusResult.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationStatusResult.java new file mode 100644 index 000000000000..d255097ff485 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationStatusResult.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.workloads.fluent.models.OperationStatusResultInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of OperationStatusResult. */ +public interface OperationStatusResult { + /** + * Gets the id property: Fully qualified ID for the async operation. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Name of the async operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the status property: Operation status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the percentComplete property: Percent of the operation that is complete. + * + * @return the percentComplete value. + */ + Float percentComplete(); + + /** + * Gets the startTime property: The start time of the operation. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time of the operation. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the operations property: The operations list. + * + * @return the operations value. + */ + List operations(); + + /** + * Gets the error property: If present, details of the operation error. + * + * @return the error value. + */ + ManagementError error(); + + /** + * Gets the inner com.azure.resourcemanager.workloads.fluent.models.OperationStatusResultInner object. + * + * @return the inner object. + */ + OperationStatusResultInner innerModel(); +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Operations.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Operations.java new file mode 100644 index 000000000000..ecd3bed6bba0 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/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.workloads.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all the available API operations under this PR. + * + * @throws com.azure.core.management.exception.ManagementException 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(); + + /** + * Lists all the available API operations under this PR. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationsDefinitionDisplay.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationsDefinitionDisplay.java new file mode 100644 index 000000000000..26dafcd71ec1 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationsDefinitionDisplay.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.annotation.Fluent; + +/** Display information of the operation. */ +@Fluent +public final class OperationsDefinitionDisplay extends OperationsDisplayDefinition { + /** {@inheritDoc} */ + @Override + public OperationsDefinitionDisplay withProvider(String provider) { + super.withProvider(provider); + return this; + } + + /** {@inheritDoc} */ + @Override + public OperationsDefinitionDisplay withResource(String resource) { + super.withResource(resource); + return this; + } + + /** {@inheritDoc} */ + @Override + public OperationsDefinitionDisplay withOperation(String operation) { + super.withOperation(operation); + return this; + } + + /** {@inheritDoc} */ + @Override + public OperationsDefinitionDisplay withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationsDisplayDefinition.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationsDisplayDefinition.java new file mode 100644 index 000000000000..72a550efd003 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/OperationsDisplayDefinition.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.workloads.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the workload operation. */ +@Fluent +public class OperationsDisplayDefinition { + /* + * Defines the workload provider. + */ + @JsonProperty(value = "provider", required = true) + private String provider; + + /* + * Defines the workload resource. + */ + @JsonProperty(value = "resource", required = true) + private String resource; + + /* + * Defines the workload operation. + */ + @JsonProperty(value = "operation", required = true) + private String operation; + + /* + * Describes the workload operation. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /** + * Get the provider property: Defines the workload provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Defines the workload provider. + * + * @param provider the provider value to set. + * @return the OperationsDisplayDefinition object itself. + */ + public OperationsDisplayDefinition withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Defines the workload resource. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Defines the workload resource. + * + * @param resource the resource value to set. + * @return the OperationsDisplayDefinition object itself. + */ + public OperationsDisplayDefinition withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Defines the workload operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Defines the workload operation. + * + * @param operation the operation value to set. + * @return the OperationsDisplayDefinition object itself. + */ + public OperationsDisplayDefinition withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Describes the workload operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Describes the workload operation. + * + * @param description the description value to set. + * @return the OperationsDisplayDefinition object itself. + */ + public OperationsDisplayDefinition withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provider() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property provider in model OperationsDisplayDefinition")); + } + if (resource() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model OperationsDisplayDefinition")); + } + if (operation() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property operation in model OperationsDisplayDefinition")); + } + if (description() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model OperationsDisplayDefinition")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationsDisplayDefinition.class); +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Origin.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Origin.java new file mode 100644 index 000000000000..06d061e42596 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Origin.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.workloads.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Origin. */ +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 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/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/PrometheusHaClusterProviderInstanceProperties.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/PrometheusHaClusterProviderInstanceProperties.java new file mode 100644 index 000000000000..6fe9ef53ea6f --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/PrometheusHaClusterProviderInstanceProperties.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Gets or sets the PrometheusHaCluster provider properties. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "providerType") +@JsonTypeName("PrometheusHaCluster") +@Fluent +public final class PrometheusHaClusterProviderInstanceProperties extends ProviderSpecificProperties { + /* + * URL of the Node Exporter endpoint. + */ + @JsonProperty(value = "prometheusUrl") + private String prometheusUrl; + + /* + * Gets or sets the target machine name. + */ + @JsonProperty(value = "hostname") + private String hostname; + + /* + * Gets or sets the cluster sid. + */ + @JsonProperty(value = "sid") + private String sid; + + /* + * Gets or sets the clusterName. + */ + @JsonProperty(value = "clusterName") + private String clusterName; + + /** + * Get the prometheusUrl property: URL of the Node Exporter endpoint. + * + * @return the prometheusUrl value. + */ + public String prometheusUrl() { + return this.prometheusUrl; + } + + /** + * Set the prometheusUrl property: URL of the Node Exporter endpoint. + * + * @param prometheusUrl the prometheusUrl value to set. + * @return the PrometheusHaClusterProviderInstanceProperties object itself. + */ + public PrometheusHaClusterProviderInstanceProperties withPrometheusUrl(String prometheusUrl) { + this.prometheusUrl = prometheusUrl; + return this; + } + + /** + * Get the hostname property: Gets or sets the target machine name. + * + * @return the hostname value. + */ + public String hostname() { + return this.hostname; + } + + /** + * Set the hostname property: Gets or sets the target machine name. + * + * @param hostname the hostname value to set. + * @return the PrometheusHaClusterProviderInstanceProperties object itself. + */ + public PrometheusHaClusterProviderInstanceProperties withHostname(String hostname) { + this.hostname = hostname; + return this; + } + + /** + * Get the sid property: Gets or sets the cluster sid. + * + * @return the sid value. + */ + public String sid() { + return this.sid; + } + + /** + * Set the sid property: Gets or sets the cluster sid. + * + * @param sid the sid value to set. + * @return the PrometheusHaClusterProviderInstanceProperties object itself. + */ + public PrometheusHaClusterProviderInstanceProperties withSid(String sid) { + this.sid = sid; + return this; + } + + /** + * Get the clusterName property: Gets or sets the clusterName. + * + * @return the clusterName value. + */ + public String clusterName() { + return this.clusterName; + } + + /** + * Set the clusterName property: Gets or sets the clusterName. + * + * @param clusterName the clusterName value to set. + * @return the PrometheusHaClusterProviderInstanceProperties object itself. + */ + public PrometheusHaClusterProviderInstanceProperties withClusterName(String clusterName) { + this.clusterName = clusterName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/PrometheusOSProviderInstanceProperties.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/PrometheusOSProviderInstanceProperties.java new file mode 100644 index 000000000000..09457144be1a --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/PrometheusOSProviderInstanceProperties.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Gets or sets the PrometheusOS provider properties. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "providerType") +@JsonTypeName("PrometheusOS") +@Fluent +public final class PrometheusOSProviderInstanceProperties extends ProviderSpecificProperties { + /* + * URL of the Node Exporter endpoint + */ + @JsonProperty(value = "prometheusUrl") + private String prometheusUrl; + + /** + * Get the prometheusUrl property: URL of the Node Exporter endpoint. + * + * @return the prometheusUrl value. + */ + public String prometheusUrl() { + return this.prometheusUrl; + } + + /** + * Set the prometheusUrl property: URL of the Node Exporter endpoint. + * + * @param prometheusUrl the prometheusUrl value to set. + * @return the PrometheusOSProviderInstanceProperties object itself. + */ + public PrometheusOSProviderInstanceProperties withPrometheusUrl(String prometheusUrl) { + this.prometheusUrl = prometheusUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstance.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstance.java new file mode 100644 index 000000000000..b9fc8b410f52 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstance.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.workloads.fluent.models.ProviderInstanceInner; + +/** An immutable client-side representation of ProviderInstance. */ +public interface ProviderInstance { + /** + * 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 provisioningState property: State of provisioning of the provider instance. + * + * @return the provisioningState value. + */ + WorkloadMonitorProvisioningState provisioningState(); + + /** + * Gets the errors property: Defines the provider instance errors. + * + * @return the errors value. + */ + ProviderInstancePropertiesErrors errors(); + + /** + * Gets the providerSettings property: Defines the provider instance errors. + * + * @return the providerSettings value. + */ + ProviderSpecificProperties providerSettings(); + + /** + * Gets the inner com.azure.resourcemanager.workloads.fluent.models.ProviderInstanceInner object. + * + * @return the inner object. + */ + ProviderInstanceInner innerModel(); + + /** The entirety of the ProviderInstance definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ProviderInstance definition stages. */ + interface DefinitionStages { + /** The first stage of the ProviderInstance definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ProviderInstance 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 SAP monitor resource. + * @return the next definition stage. + */ + WithCreate withExistingMonitor(String resourceGroupName, String monitorName); + } + /** + * The stage of the ProviderInstance 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.WithProviderSettings { + /** + * Executes the create request. + * + * @return the created resource. + */ + ProviderInstance create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ProviderInstance create(Context context); + } + /** The stage of the ProviderInstance definition allowing to specify providerSettings. */ + interface WithProviderSettings { + /** + * Specifies the providerSettings property: Defines the provider instance errors.. + * + * @param providerSettings Defines the provider instance errors. + * @return the next definition stage. + */ + WithCreate withProviderSettings(ProviderSpecificProperties providerSettings); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ProviderInstance refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ProviderInstance refresh(Context context); +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstanceListResult.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstanceListResult.java new file mode 100644 index 000000000000..48c24b97f816 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstanceListResult.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.workloads.fluent.models.ProviderInstanceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response from the List provider instances operation. */ +@Fluent +public final class ProviderInstanceListResult { + /* + * The list of provider instances. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to get the next set of provider instances. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of provider instances. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of provider instances. + * + * @param value the value value to set. + * @return the ProviderInstanceListResult object itself. + */ + public ProviderInstanceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to get the next set of provider instances. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to get the next set of provider instances. + * + * @param nextLink the nextLink value to set. + * @return the ProviderInstanceListResult object itself. + */ + public ProviderInstanceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstancePropertiesErrors.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstancePropertiesErrors.java new file mode 100644 index 000000000000..13ec2ebdbd92 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstancePropertiesErrors.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.workloads.models; + +import com.azure.core.annotation.Immutable; + +/** Defines the provider instance errors. */ +@Immutable +public final class ProviderInstancePropertiesErrors extends Error { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstances.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstances.java new file mode 100644 index 000000000000..d1953abd7891 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderInstances.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.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 ProviderInstances. */ +public interface ProviderInstances { + /** + * Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each + * provider instances. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor 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 list of provider instances in the specified SAP monitor as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String monitorName); + + /** + * Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each + * provider instances. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP 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 a list of provider instances in the specified SAP monitor as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String monitorName, Context context); + + /** + * Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a provider instance for the specified subscription, resource group, Monitor name, and + * resource name. + */ + ProviderInstance get(String resourceGroupName, String monitorName, String providerInstanceName); + + /** + * Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a provider instance for the specified subscription, resource group, Monitor name, and + * resource name along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String monitorName, String providerInstanceName, Context context); + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + OperationStatusResult delete(String resourceGroupName, String monitorName, String providerInstanceName); + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + OperationStatusResult delete( + String resourceGroupName, String monitorName, String providerInstanceName, Context context); + + /** + * Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource + * name. + * + * @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 properties of a provider instance for the specified subscription, resource group, Monitor name, and + * resource name along with {@link Response}. + */ + ProviderInstance getById(String id); + + /** + * Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource + * name. + * + * @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 properties of a provider instance for the specified subscription, resource group, Monitor name, and + * resource name along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + OperationStatusResult deleteById(String id); + + /** + * Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + OperationStatusResult deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ProviderInstance resource. + * + * @param name resource name. + * @return the first stage of the new ProviderInstance definition. + */ + ProviderInstance.DefinitionStages.Blank define(String name); +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderSpecificProperties.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderSpecificProperties.java new file mode 100644 index 000000000000..9e5492e50740 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/ProviderSpecificProperties.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.workloads.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Gets or sets the provider specific properties. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "providerType", + defaultImpl = ProviderSpecificProperties.class) +@JsonTypeName("ProviderSpecificProperties") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "SapHana", value = HanaDbProviderInstanceProperties.class), + @JsonSubTypes.Type(name = "SapNetWeaver", value = SapNetWeaverProviderInstanceProperties.class), + @JsonSubTypes.Type(name = "PrometheusOS", value = PrometheusOSProviderInstanceProperties.class), + @JsonSubTypes.Type(name = "Db2", value = DB2ProviderInstanceProperties.class), + @JsonSubTypes.Type(name = "PrometheusHaCluster", value = PrometheusHaClusterProviderInstanceProperties.class), + @JsonSubTypes.Type(name = "MsSqlServer", value = MsSqlServerProviderInstanceProperties.class) +}) +@Immutable +public class ProviderSpecificProperties { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/RoutingPreference.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/RoutingPreference.java new file mode 100644 index 000000000000..1f72fa803f75 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/RoutingPreference.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.workloads.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RoutingPreference. */ +public final class RoutingPreference extends ExpandableStringEnum { + /** Static value Default for RoutingPreference. */ + public static final RoutingPreference DEFAULT = fromString("Default"); + + /** Static value RouteAll for RoutingPreference. */ + public static final RoutingPreference ROUTE_ALL = fromString("RouteAll"); + + /** + * Creates or finds a RoutingPreference from its string representation. + * + * @param name a name to look for. + * @return the corresponding RoutingPreference. + */ + @JsonCreator + public static RoutingPreference fromString(String name) { + return fromString(name, RoutingPreference.class); + } + + /** + * Gets known RoutingPreference values. + * + * @return known RoutingPreference values. + */ + public static Collection values() { + return values(RoutingPreference.class); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/SapNetWeaverProviderInstanceProperties.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/SapNetWeaverProviderInstanceProperties.java new file mode 100644 index 000000000000..232af284167e --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/SapNetWeaverProviderInstanceProperties.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Gets or sets the provider properties. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "providerType") +@JsonTypeName("SapNetWeaver") +@Fluent +public final class SapNetWeaverProviderInstanceProperties extends ProviderSpecificProperties { + /* + * Gets or sets the SAP System Identifier + */ + @JsonProperty(value = "sapSid") + private String sapSid; + + /* + * Gets or sets the target virtual machine IP Address/FQDN. + */ + @JsonProperty(value = "sapHostname") + private String sapHostname; + + /* + * Gets or sets the instance number of SAP NetWeaver. + */ + @JsonProperty(value = "sapInstanceNr") + private String sapInstanceNr; + + /* + * Gets or sets the list of HostFile Entries + */ + @JsonProperty(value = "sapHostFileEntries") + private List sapHostFileEntries; + + /* + * Gets or sets the SAP user name. + */ + @JsonProperty(value = "sapUsername") + private String sapUsername; + + /* + * Sets the SAP password. + */ + @JsonProperty(value = "sapPassword") + private String sapPassword; + + /* + * Gets or sets the key vault URI to secret with the SAP password. + */ + @JsonProperty(value = "sapPasswordUri") + private String sapPasswordUri; + + /* + * Gets or sets the SAP Client ID. + */ + @JsonProperty(value = "sapClientId") + private String sapClientId; + + /* + * Gets or sets the SAP HTTP port number. + */ + @JsonProperty(value = "sapPortNumber") + private String sapPortNumber; + + /* + * Gets or sets the blob URI to SSL certificate for the SAP system. + */ + @JsonProperty(value = "sapSslCertificateUri") + private String sapSslCertificateUri; + + /** + * Get the sapSid property: Gets or sets the SAP System Identifier. + * + * @return the sapSid value. + */ + public String sapSid() { + return this.sapSid; + } + + /** + * Set the sapSid property: Gets or sets the SAP System Identifier. + * + * @param sapSid the sapSid value to set. + * @return the SapNetWeaverProviderInstanceProperties object itself. + */ + public SapNetWeaverProviderInstanceProperties withSapSid(String sapSid) { + this.sapSid = sapSid; + return this; + } + + /** + * Get the sapHostname property: Gets or sets the target virtual machine IP Address/FQDN. + * + * @return the sapHostname value. + */ + public String sapHostname() { + return this.sapHostname; + } + + /** + * Set the sapHostname property: Gets or sets the target virtual machine IP Address/FQDN. + * + * @param sapHostname the sapHostname value to set. + * @return the SapNetWeaverProviderInstanceProperties object itself. + */ + public SapNetWeaverProviderInstanceProperties withSapHostname(String sapHostname) { + this.sapHostname = sapHostname; + return this; + } + + /** + * Get the sapInstanceNr property: Gets or sets the instance number of SAP NetWeaver. + * + * @return the sapInstanceNr value. + */ + public String sapInstanceNr() { + return this.sapInstanceNr; + } + + /** + * Set the sapInstanceNr property: Gets or sets the instance number of SAP NetWeaver. + * + * @param sapInstanceNr the sapInstanceNr value to set. + * @return the SapNetWeaverProviderInstanceProperties object itself. + */ + public SapNetWeaverProviderInstanceProperties withSapInstanceNr(String sapInstanceNr) { + this.sapInstanceNr = sapInstanceNr; + return this; + } + + /** + * Get the sapHostFileEntries property: Gets or sets the list of HostFile Entries. + * + * @return the sapHostFileEntries value. + */ + public List sapHostFileEntries() { + return this.sapHostFileEntries; + } + + /** + * Set the sapHostFileEntries property: Gets or sets the list of HostFile Entries. + * + * @param sapHostFileEntries the sapHostFileEntries value to set. + * @return the SapNetWeaverProviderInstanceProperties object itself. + */ + public SapNetWeaverProviderInstanceProperties withSapHostFileEntries(List sapHostFileEntries) { + this.sapHostFileEntries = sapHostFileEntries; + return this; + } + + /** + * Get the sapUsername property: Gets or sets the SAP user name. + * + * @return the sapUsername value. + */ + public String sapUsername() { + return this.sapUsername; + } + + /** + * Set the sapUsername property: Gets or sets the SAP user name. + * + * @param sapUsername the sapUsername value to set. + * @return the SapNetWeaverProviderInstanceProperties object itself. + */ + public SapNetWeaverProviderInstanceProperties withSapUsername(String sapUsername) { + this.sapUsername = sapUsername; + return this; + } + + /** + * Get the sapPassword property: Sets the SAP password. + * + * @return the sapPassword value. + */ + public String sapPassword() { + return this.sapPassword; + } + + /** + * Set the sapPassword property: Sets the SAP password. + * + * @param sapPassword the sapPassword value to set. + * @return the SapNetWeaverProviderInstanceProperties object itself. + */ + public SapNetWeaverProviderInstanceProperties withSapPassword(String sapPassword) { + this.sapPassword = sapPassword; + return this; + } + + /** + * Get the sapPasswordUri property: Gets or sets the key vault URI to secret with the SAP password. + * + * @return the sapPasswordUri value. + */ + public String sapPasswordUri() { + return this.sapPasswordUri; + } + + /** + * Set the sapPasswordUri property: Gets or sets the key vault URI to secret with the SAP password. + * + * @param sapPasswordUri the sapPasswordUri value to set. + * @return the SapNetWeaverProviderInstanceProperties object itself. + */ + public SapNetWeaverProviderInstanceProperties withSapPasswordUri(String sapPasswordUri) { + this.sapPasswordUri = sapPasswordUri; + return this; + } + + /** + * Get the sapClientId property: Gets or sets the SAP Client ID. + * + * @return the sapClientId value. + */ + public String sapClientId() { + return this.sapClientId; + } + + /** + * Set the sapClientId property: Gets or sets the SAP Client ID. + * + * @param sapClientId the sapClientId value to set. + * @return the SapNetWeaverProviderInstanceProperties object itself. + */ + public SapNetWeaverProviderInstanceProperties withSapClientId(String sapClientId) { + this.sapClientId = sapClientId; + return this; + } + + /** + * Get the sapPortNumber property: Gets or sets the SAP HTTP port number. + * + * @return the sapPortNumber value. + */ + public String sapPortNumber() { + return this.sapPortNumber; + } + + /** + * Set the sapPortNumber property: Gets or sets the SAP HTTP port number. + * + * @param sapPortNumber the sapPortNumber value to set. + * @return the SapNetWeaverProviderInstanceProperties object itself. + */ + public SapNetWeaverProviderInstanceProperties withSapPortNumber(String sapPortNumber) { + this.sapPortNumber = sapPortNumber; + return this; + } + + /** + * Get the sapSslCertificateUri property: Gets or sets the blob URI to SSL certificate for the SAP system. + * + * @return the sapSslCertificateUri value. + */ + public String sapSslCertificateUri() { + return this.sapSslCertificateUri; + } + + /** + * Set the sapSslCertificateUri property: Gets or sets the blob URI to SSL certificate for the SAP system. + * + * @param sapSslCertificateUri the sapSslCertificateUri value to set. + * @return the SapNetWeaverProviderInstanceProperties object itself. + */ + public SapNetWeaverProviderInstanceProperties withSapSslCertificateUri(String sapSslCertificateUri) { + this.sapSslCertificateUri = sapSslCertificateUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Tags.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Tags.java new file mode 100644 index 000000000000..1e17c631ccdc --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/Tags.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Tags field of the resource. */ +@Fluent +public final class Tags { + /* + * Tags field of the resource. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Tags field of the resource. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags field of the resource. + * + * @param tags the tags value to set. + * @return the Tags object itself. + */ + public Tags withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/WorkloadMonitorProvisioningState.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/WorkloadMonitorProvisioningState.java new file mode 100644 index 000000000000..8399e2222789 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/WorkloadMonitorProvisioningState.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.workloads.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for WorkloadMonitorProvisioningState. */ +public final class WorkloadMonitorProvisioningState extends ExpandableStringEnum { + /** Static value Accepted for WorkloadMonitorProvisioningState. */ + public static final WorkloadMonitorProvisioningState ACCEPTED = fromString("Accepted"); + + /** Static value Creating for WorkloadMonitorProvisioningState. */ + public static final WorkloadMonitorProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for WorkloadMonitorProvisioningState. */ + public static final WorkloadMonitorProvisioningState UPDATING = fromString("Updating"); + + /** Static value Failed for WorkloadMonitorProvisioningState. */ + public static final WorkloadMonitorProvisioningState FAILED = fromString("Failed"); + + /** Static value Succeeded for WorkloadMonitorProvisioningState. */ + public static final WorkloadMonitorProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Deleting for WorkloadMonitorProvisioningState. */ + public static final WorkloadMonitorProvisioningState DELETING = fromString("Deleting"); + + /** Static value Migrating for WorkloadMonitorProvisioningState. */ + public static final WorkloadMonitorProvisioningState MIGRATING = fromString("Migrating"); + + /** + * Creates or finds a WorkloadMonitorProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding WorkloadMonitorProvisioningState. + */ + @JsonCreator + public static WorkloadMonitorProvisioningState fromString(String name) { + return fromString(name, WorkloadMonitorProvisioningState.class); + } + + /** + * Gets known WorkloadMonitorProvisioningState values. + * + * @return known WorkloadMonitorProvisioningState values. + */ + public static Collection values() { + return values(WorkloadMonitorProvisioningState.class); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/package-info.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/package-info.java new file mode 100644 index 000000000000..2f6a5989e4b9 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for WorkloadsClient. Workloads client provides access to various workload + * operations. + */ +package com.azure.resourcemanager.workloads.models; diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/package-info.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/package-info.java new file mode 100644 index 000000000000..4924daac0dd9 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/com/azure/resourcemanager/workloads/package-info.java @@ -0,0 +1,8 @@ +// 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 WorkloadsClient. Workloads client provides access to various workload operations. + */ +package com.azure.resourcemanager.workloads; diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/main/java/module-info.java b/sdk/workloads/azure-resourcemanager-workloads/src/main/java/module-info.java new file mode 100644 index 000000000000..a3ada2c389d4 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/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.workloads { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.workloads; + exports com.azure.resourcemanager.workloads.fluent; + exports com.azure.resourcemanager.workloads.fluent.models; + exports com.azure.resourcemanager.workloads.models; + + opens com.azure.resourcemanager.workloads.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.workloads.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsCreateSamples.java b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsCreateSamples.java new file mode 100644 index 000000000000..5065ac4482d0 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsCreateSamples.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.generated; + +import com.azure.resourcemanager.workloads.models.ManagedRGConfiguration; +import com.azure.resourcemanager.workloads.models.RoutingPreference; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Monitors Create. */ +public final class MonitorsCreateSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_Create.json + */ + /** + * Sample code: Create a SAP Monitor. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createASAPMonitor(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .monitors() + .define("mySapMonitor") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf("key", "value")) + .withAppLocation("westus") + .withRoutingPreference(RoutingPreference.ROUTE_ALL) + .withManagedResourceGroupConfiguration(new ManagedRGConfiguration().withName("myManagedRg")) + .withLogAnalyticsWorkspaceArmId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace") + .withMonitorSubnet( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet") + .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/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsDeleteSamples.java b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsDeleteSamples.java new file mode 100644 index 000000000000..037c321d21d5 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.generated; + +import com.azure.core.util.Context; + +/** Samples for Monitors Delete. */ +public final class MonitorsDeleteSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_Delete.json + */ + /** + * Sample code: Deletes a SAP monitor. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void deletesASAPMonitor(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.monitors().delete("myResourceGroup", "mySapMonitor", Context.NONE); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsGetByResourceGroupSamples.java b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..b79d70ab56e2 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.generated; + +import com.azure.core.util.Context; + +/** Samples for Monitors GetByResourceGroup. */ +public final class MonitorsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_Get.json + */ + /** + * Sample code: Get properties of a SAP monitor. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfASAPMonitor(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.monitors().getByResourceGroupWithResponse("myResourceGroup", "mySapMonitor", Context.NONE); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsListByResourceGroupSamples.java b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsListByResourceGroupSamples.java new file mode 100644 index 000000000000..6184b59dc067 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.generated; + +import com.azure.core.util.Context; + +/** Samples for Monitors ListByResourceGroup. */ +public final class MonitorsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_ListByRG.json + */ + /** + * Sample code: List all SAP Monitors in a resource group. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void listAllSAPMonitorsInAResourceGroup( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.monitors().listByResourceGroup("example-rg", Context.NONE); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsListSamples.java b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsListSamples.java new file mode 100644 index 000000000000..f242da8cd498 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.generated; + +import com.azure.core.util.Context; + +/** Samples for Monitors List. */ +public final class MonitorsListSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_List.json + */ + /** + * Sample code: List all SAP Monitors in a subscription. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void listAllSAPMonitorsInASubscription(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.monitors().list(Context.NONE); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsUpdateSamples.java b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsUpdateSamples.java new file mode 100644 index 000000000000..08fc27f88f7f --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/MonitorsUpdateSamples.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.workloads.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.workloads.models.Monitor; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Monitors Update. */ +public final class MonitorsUpdateSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_PatchTags_Delete.json + */ + /** + * Sample code: Delete Tags field of a SAP monitor. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void deleteTagsFieldOfASAPMonitor(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + Monitor resource = + manager + .monitors() + .getByResourceGroupWithResponse("myResourceGroup", "mySapMonitor", Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).apply(); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/monitors_PatchTags.json + */ + /** + * Sample code: Update Tags field of a SAP monitor. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void updateTagsFieldOfASAPMonitor(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + Monitor resource = + manager + .monitors() + .getByResourceGroupWithResponse("myResourceGroup", "mySapMonitor", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("testkey", "testvalue")).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/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/OperationsListSamples.java b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/OperationsListSamples.java new file mode 100644 index 000000000000..c3d3422ee5e4 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void operations(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesCreateSamples.java b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesCreateSamples.java new file mode 100644 index 000000000000..ba43fb0da2f1 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesCreateSamples.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.generated; + +import com.azure.resourcemanager.workloads.models.DB2ProviderInstanceProperties; +import com.azure.resourcemanager.workloads.models.HanaDbProviderInstanceProperties; +import com.azure.resourcemanager.workloads.models.MsSqlServerProviderInstanceProperties; +import com.azure.resourcemanager.workloads.models.PrometheusHaClusterProviderInstanceProperties; +import com.azure.resourcemanager.workloads.models.PrometheusOSProviderInstanceProperties; +import com.azure.resourcemanager.workloads.models.SapNetWeaverProviderInstanceProperties; +import java.util.Arrays; + +/** Samples for ProviderInstances Create. */ +public final class ProviderInstancesCreateSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/ProviderInstances_Create.json + */ + /** + * Sample code: Create a SAP Monitor Hana provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createASAPMonitorHanaProvider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .define("myProviderInstance") + .withExistingMonitor("myResourceGroup", "mySapMonitor") + .withProviderSettings( + new HanaDbProviderInstanceProperties() + .withHostname("name") + .withDbName("db") + .withSqlPort("0000") + .withInstanceNumber("00") + .withDbUsername("user") + .withDbPassword("****") + .withDbPasswordUri("") + .withDbSslCertificateUri("https://storageaccount.blob.core.windows.net/containername/filename") + .withSslHostnameInCertificate("xyz.domain.com")) + .create(); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/NetWeaverProviderInstances_Create.json + */ + /** + * Sample code: Create a SAP Monitor NetWeaver provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createASAPMonitorNetWeaverProvider( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .define("myProviderInstance") + .withExistingMonitor("myResourceGroup", "mySapMonitor") + .withProviderSettings( + new SapNetWeaverProviderInstanceProperties() + .withSapSid("SID") + .withSapHostname("name") + .withSapInstanceNr("00") + .withSapHostFileEntries(Arrays.asList("127.0.0.1 name fqdn")) + .withSapUsername("username") + .withSapPassword("****") + .withSapPasswordUri("") + .withSapClientId("111") + .withSapPortNumber("1234") + .withSapSslCertificateUri("https://storageaccount.blob.core.windows.net/containername/filename")) + .create(); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/MsSqlServerProviderInstance_Create.json + */ + /** + * Sample code: Create a MsSqlServer provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createAMsSqlServerProvider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .define("myProviderInstance") + .withExistingMonitor("myResourceGroup", "mySapMonitor") + .withProviderSettings( + new MsSqlServerProviderInstanceProperties() + .withHostname("hostname") + .withDbPort("5912") + .withDbUsername("user") + .withDbPassword("****") + .withDbPasswordUri("") + .withSapSid("sid")) + .create(); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Create.json + */ + /** + * Sample code: Create a PrometheusHaCluster provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createAPrometheusHaClusterProvider( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .define("myProviderInstance") + .withExistingMonitor("myResourceGroup", "mySapMonitor") + .withProviderSettings( + new PrometheusHaClusterProviderInstanceProperties() + .withPrometheusUrl("http://192.168.0.0:9090/metrics") + .withHostname("hostname") + .withSid("sid") + .withClusterName("clusterName")) + .create(); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/Db2ProviderInstances_Create.json + */ + /** + * Sample code: Create a Db2 provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createADb2Provider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .define("myProviderInstance") + .withExistingMonitor("myResourceGroup", "mySapMonitor") + .withProviderSettings( + new DB2ProviderInstanceProperties() + .withHostname("hostname") + .withDbName("dbName") + .withDbPort("dbPort") + .withDbUsername("username") + .withDbPassword("password") + .withDbPasswordUri("") + .withSapSid("SID")) + .create(); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusOSProviderInstances_Create.json + */ + /** + * Sample code: Create a OS provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void createAOSProvider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .define("myProviderInstance") + .withExistingMonitor("myResourceGroup", "mySapMonitor") + .withProviderSettings( + new PrometheusOSProviderInstanceProperties().withPrometheusUrl("http://192.168.0.0:9090/metrics")) + .create(); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesDeleteSamples.java b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesDeleteSamples.java new file mode 100644 index 000000000000..4f51768d6464 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.generated; + +import com.azure.core.util.Context; + +/** Samples for ProviderInstances Delete. */ +public final class ProviderInstancesDeleteSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/ProviderInstances_Delete.json + */ + /** + * Sample code: Deletes a SAP monitor provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void deletesASAPMonitorProvider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.providerInstances().delete("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesGetSamples.java b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesGetSamples.java new file mode 100644 index 000000000000..aadcd35b48e5 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesGetSamples.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.generated; + +import com.azure.core.util.Context; + +/** Samples for ProviderInstances Get. */ +public final class ProviderInstancesGetSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/ProviderInstances_Get.json + */ + /** + * Sample code: Get properties of a SAP monitor Hana provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfASAPMonitorHanaProvider( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .getWithResponse("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Get.json + */ + /** + * Sample code: Get properties of a PrometheusHaCluster provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfAPrometheusHaClusterProvider( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .getWithResponse("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/PrometheusOSProviderInstances_Get.json + */ + /** + * Sample code: Get properties of a OS provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfAOSProvider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .getWithResponse("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/Db2ProviderInstances_Get.json + */ + /** + * Sample code: Get properties of a Db2 provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfADb2Provider(com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .getWithResponse("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/MsSqlServerProviderInstance_Get.json + */ + /** + * Sample code: Get properties of a MsSqlServer provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfAMsSqlServerProvider( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .getWithResponse("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } + + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/NetWeaverProviderInstances_Get.json + */ + /** + * Sample code: Get properties of a SAP monitor NetWeaver provider. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void getPropertiesOfASAPMonitorNetWeaverProvider( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager + .providerInstances() + .getWithResponse("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE); + } +} diff --git a/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesListSamples.java b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesListSamples.java new file mode 100644 index 000000000000..60f640c918b2 --- /dev/null +++ b/sdk/workloads/azure-resourcemanager-workloads/src/samples/java/com/azure/resourcemanager/workloads/generated/ProviderInstancesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloads.generated; + +import com.azure.core.util.Context; + +/** Samples for ProviderInstances List. */ +public final class ProviderInstancesListSamples { + /* + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/workloadmonitor/ProviderInstances_List.json + */ + /** + * Sample code: List all SAP Monitors providers in a subscription. + * + * @param manager Entry point to WorkloadsManager. + */ + public static void listAllSAPMonitorsProvidersInASubscription( + com.azure.resourcemanager.workloads.WorkloadsManager manager) { + manager.providerInstances().list("myResourceGroup", "mySapMonitor", Context.NONE); + } +} diff --git a/sdk/workloads/ci.yml b/sdk/workloads/ci.yml new file mode 100644 index 000000000000..21c41f510fa3 --- /dev/null +++ b/sdk/workloads/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/workloads/ci.yml + - sdk/workloads/azure-resourcemanager-workloads/ + exclude: + - sdk/workloads/pom.xml + - sdk/workloads/azure-resourcemanager-workloads/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/workloads/ci.yml + - sdk/workloads/azure-resourcemanager-workloads/ + exclude: + - sdk/workloads/pom.xml + - sdk/workloads/azure-resourcemanager-workloads/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: workloads + Artifacts: + - name: azure-resourcemanager-workloads + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerworkloads diff --git a/sdk/workloads/pom.xml b/sdk/workloads/pom.xml new file mode 100644 index 000000000000..462a349429e8 --- /dev/null +++ b/sdk/workloads/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-workloads-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-workloads + + + +