From 53392162abf2f75343442f75cc1c5f88db157419 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 6 Jan 2022 05:17:50 +0000 Subject: [PATCH] CodeGen from PR 17194 in Azure/azure-rest-api-specs Merge 892f21d7ef64f1168482967215406d564a331cf9 into 2b0d06424d8f6d267778bb3576ad171413ee1ad8 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../azure-resourcemanager-oep/CHANGELOG.md | 5 + sdk/oep/azure-resourcemanager-oep/README.md | 102 ++ sdk/oep/azure-resourcemanager-oep/SAMPLE.md | 203 +++ sdk/oep/azure-resourcemanager-oep/pom.xml | 81 + .../azure/resourcemanager/oep/OepManager.java | 266 +++ .../oep/fluent/EnergyServicesClient.java | 243 +++ .../oep/fluent/LocationsClient.java | 41 + ...enEnergyPlatformManagementServiceAPIs.java | 67 + .../oep/fluent/OperationsClient.java | 36 + .../CheckNameAvailabilityResponseInner.java | 103 ++ .../oep/fluent/models/EnergyServiceInner.java | 132 ++ .../models/OperationListResultInner.java | 62 + .../oep/fluent/models/package-info.java | 9 + .../oep/fluent/package-info.java | 9 + .../CheckNameAvailabilityResponseImpl.java | 41 + .../oep/implementation/EnergyServiceImpl.java | 186 +++ .../EnergyServicesClientImpl.java | 1466 +++++++++++++++++ .../implementation/EnergyServicesImpl.java | 174 ++ .../implementation/LocationsClientImpl.java | 196 +++ .../oep/implementation/LocationsImpl.java | 61 + ...yPlatformManagementServiceAPIsBuilder.java | 146 ++ ...ergyPlatformManagementServiceAPIsImpl.java | 321 ++++ .../OperationListResultImpl.java | 44 + .../implementation/OperationsClientImpl.java | 156 ++ .../oep/implementation/OperationsImpl.java | 58 + .../oep/implementation/Utils.java | 204 +++ .../oep/implementation/package-info.java | 9 + .../oep/models/ActionType.java | 31 + .../models/CheckNameAvailabilityReason.java | 34 + .../models/CheckNameAvailabilityRequest.java | 76 + .../models/CheckNameAvailabilityResponse.java | 38 + .../oep/models/DataPartitionNames.java | 50 + .../oep/models/EnergyResourceUpdate.java | 53 + .../oep/models/EnergyService.java | 217 +++ .../oep/models/EnergyServiceList.java | 81 + .../oep/models/EnergyServiceProperties.java | 110 ++ .../oep/models/EnergyServices.java | 156 ++ .../resourcemanager/oep/models/Locations.java | 35 + .../resourcemanager/oep/models/Operation.java | 122 ++ .../oep/models/OperationDisplay.java | 93 ++ .../oep/models/OperationListResult.java | 32 + .../oep/models/Operations.java | 31 + .../resourcemanager/oep/models/Origin.java | 37 + .../oep/models/ProvisioningState.java | 49 + .../oep/models/package-info.java | 9 + .../resourcemanager/oep/package-info.java | 9 + .../src/main/java/module-info.java | 19 + .../EnergyServicesCreateSamples.java | 25 + .../EnergyServicesDeleteSamples.java | 22 + ...ergyServicesGetByResourceGroupSamples.java | 24 + ...rgyServicesListByResourceGroupSamples.java | 22 + .../generated/EnergyServicesListSamples.java | 22 + .../EnergyServicesUpdateSamples.java | 28 + ...LocationsCheckNameAvailabilitySamples.java | 27 + .../oep/generated/OperationsListSamples.java | 22 + sdk/oep/ci.yml | 39 + sdk/oep/pom.xml | 53 + 59 files changed, 5989 insertions(+) create mode 100644 sdk/oep/azure-resourcemanager-oep/CHANGELOG.md create mode 100644 sdk/oep/azure-resourcemanager-oep/README.md create mode 100644 sdk/oep/azure-resourcemanager-oep/SAMPLE.md create mode 100644 sdk/oep/azure-resourcemanager-oep/pom.xml create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/OepManager.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/EnergyServicesClient.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/LocationsClient.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/OpenEnergyPlatformManagementServiceAPIs.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/OperationsClient.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/CheckNameAvailabilityResponseInner.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/EnergyServiceInner.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/OperationListResultInner.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/package-info.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/package-info.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/CheckNameAvailabilityResponseImpl.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/EnergyServiceImpl.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/EnergyServicesClientImpl.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/EnergyServicesImpl.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/LocationsClientImpl.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/LocationsImpl.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OpenEnergyPlatformManagementServiceAPIsBuilder.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OpenEnergyPlatformManagementServiceAPIsImpl.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OperationListResultImpl.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OperationsClientImpl.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OperationsImpl.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/Utils.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/package-info.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/ActionType.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/CheckNameAvailabilityReason.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/CheckNameAvailabilityRequest.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/CheckNameAvailabilityResponse.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/DataPartitionNames.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyResourceUpdate.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyService.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyServiceList.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyServiceProperties.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyServices.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Locations.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Operation.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/OperationDisplay.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/OperationListResult.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Operations.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Origin.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/ProvisioningState.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/package-info.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/package-info.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/main/java/module-info.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesCreateSamples.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesDeleteSamples.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesGetByResourceGroupSamples.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesListByResourceGroupSamples.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesListSamples.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesUpdateSamples.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/LocationsCheckNameAvailabilitySamples.java create mode 100644 sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/OperationsListSamples.java create mode 100644 sdk/oep/ci.yml create mode 100644 sdk/oep/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b7a2f80351770..b221210b4328e 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -331,6 +331,7 @@ com.azure.resourcemanager:azure-resourcemanager-desktopvirtualization;1.0.0-beta com.azure.resourcemanager:azure-resourcemanager-loadtestservice;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-automanage;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-edgeorder;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-oep;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current diff --git a/pom.xml b/pom.xml index aab77f33ebeb9..6997f73761050 100644 --- a/pom.xml +++ b/pom.xml @@ -802,6 +802,7 @@ sdk/mysqlflexibleserver sdk/netapp sdk/notificationhubs + sdk/oep sdk/operationsmanagement sdk/parents sdk/peering diff --git a/sdk/oep/azure-resourcemanager-oep/CHANGELOG.md b/sdk/oep/azure-resourcemanager-oep/CHANGELOG.md new file mode 100644 index 0000000000000..8ec77d69d5a50 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-01-06) + +- Azure Resource Manager oep client library for Java. This package contains Microsoft Azure SDK for oep Management SDK. Open Energy Platform Management Service APIs. Package tag package-2021-06-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/oep/azure-resourcemanager-oep/README.md b/sdk/oep/azure-resourcemanager-oep/README.md new file mode 100644 index 0000000000000..e030e65d2214b --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager oep client library for Java + +Azure Resource Manager oep client library for Java. + +This package contains Microsoft Azure SDK for oep Management SDK. Open Energy Platform Management Service APIs. Package tag package-2021-06-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-oep;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-oep + 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(); +OepManager manager = OepManager + .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/oep/azure-resourcemanager-oep/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/oep/azure-resourcemanager-oep/SAMPLE.md b/sdk/oep/azure-resourcemanager-oep/SAMPLE.md new file mode 100644 index 0000000000000..a1642f1c945c6 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/SAMPLE.md @@ -0,0 +1,203 @@ +# Code snippets and samples + + +## EnergyServices + +- [Create](#energyservices_create) +- [Delete](#energyservices_delete) +- [GetByResourceGroup](#energyservices_getbyresourcegroup) +- [List](#energyservices_list) +- [ListByResourceGroup](#energyservices_listbyresourcegroup) +- [Update](#energyservices_update) + +## Locations + +- [CheckNameAvailability](#locations_checknameavailability) + +## Operations + +- [List](#operations_list) +### EnergyServices_Create + +```java +/** Samples for EnergyServices Create. */ +public final class EnergyServicesCreateSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/OepResource_Create.json + */ + /** + * Sample code: OepResource_Create. + * + * @param manager Entry point to OepManager. + */ + public static void oepResourceCreate(com.azure.resourcemanager.oep.OepManager manager) { + manager + .energyServices() + .define("DummyResourceName") + .withRegion((String) null) + .withExistingResourceGroup("DummyResourceGroupName") + .create(); + } +} +``` + +### EnergyServices_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for EnergyServices Delete. */ +public final class EnergyServicesDeleteSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/OepResource_Delete.json + */ + /** + * Sample code: OepResource_Delete. + * + * @param manager Entry point to OepManager. + */ + public static void oepResourceDelete(com.azure.resourcemanager.oep.OepManager manager) { + manager.energyServices().delete("DummyResourceGroupName", "DummyResourceName", Context.NONE); + } +} +``` + +### EnergyServices_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for EnergyServices GetByResourceGroup. */ +public final class EnergyServicesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/OepResource_Get.json + */ + /** + * Sample code: OepResource_Get. + * + * @param manager Entry point to OepManager. + */ + public static void oepResourceGet(com.azure.resourcemanager.oep.OepManager manager) { + manager + .energyServices() + .getByResourceGroupWithResponse("DummyResourceGroupName", "DummyResourceName", Context.NONE); + } +} +``` + +### EnergyServices_List + +```java +import com.azure.core.util.Context; + +/** Samples for EnergyServices List. */ +public final class EnergyServicesListSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/OepResource_ListBySubscriptionId.json + */ + /** + * Sample code: OepResource_ListBySubscriptionId. + * + * @param manager Entry point to OepManager. + */ + public static void oepResourceListBySubscriptionId(com.azure.resourcemanager.oep.OepManager manager) { + manager.energyServices().list(Context.NONE); + } +} +``` + +### EnergyServices_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for EnergyServices ListByResourceGroup. */ +public final class EnergyServicesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/OepResource_ListByResourceGroup.json + */ + /** + * Sample code: OepResource_ListByResourceGroup. + * + * @param manager Entry point to OepManager. + */ + public static void oepResourceListByResourceGroup(com.azure.resourcemanager.oep.OepManager manager) { + manager.energyServices().listByResourceGroup("DummyResourceGroupName", Context.NONE); + } +} +``` + +### EnergyServices_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.oep.models.EnergyService; + +/** Samples for EnergyServices Update. */ +public final class EnergyServicesUpdateSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/OepResource_Update.json + */ + /** + * Sample code: OepResource_Update. + * + * @param manager Entry point to OepManager. + */ + public static void oepResourceUpdate(com.azure.resourcemanager.oep.OepManager manager) { + EnergyService resource = + manager + .energyServices() + .getByResourceGroupWithResponse("DummyResourceGroupName", "DummyResourceName", Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + +### Locations_CheckNameAvailability + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.oep.models.CheckNameAvailabilityRequest; + +/** Samples for Locations CheckNameAvailability. */ +public final class LocationsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/Locations_CheckNameAvailability.json + */ + /** + * Sample code: Locations_CheckNameAvailability. + * + * @param manager Entry point to OepManager. + */ + public static void locationsCheckNameAvailability(com.azure.resourcemanager.oep.OepManager manager) { + manager + .locations() + .checkNameAvailabilityWithResponse( + new CheckNameAvailabilityRequest().withName("sample-name").withType("Microsoft.OEP/oepResource"), + Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to OepManager. + */ + public static void operationsList(com.azure.resourcemanager.oep.OepManager manager) { + manager.operations().listWithResponse(Context.NONE); + } +} +``` + diff --git a/sdk/oep/azure-resourcemanager-oep/pom.xml b/sdk/oep/azure-resourcemanager-oep/pom.xml new file mode 100644 index 0000000000000..b9f5a62762d9f --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/pom.xml @@ -0,0 +1,81 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-oep + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for oep Management + This package contains Microsoft Azure SDK for oep Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Open Energy Platform Management Service APIs. Package tag package-2021-06-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 + false + + + + + + com.azure + azure-core + 1.23.1 + + + com.azure + azure-core-management + 1.4.4 + + + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/OepManager.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/OepManager.java new file mode 100644 index 0000000000000..8c455e7e4edbc --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/OepManager.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep; + +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.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.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.oep.fluent.OpenEnergyPlatformManagementServiceAPIs; +import com.azure.resourcemanager.oep.implementation.EnergyServicesImpl; +import com.azure.resourcemanager.oep.implementation.LocationsImpl; +import com.azure.resourcemanager.oep.implementation.OpenEnergyPlatformManagementServiceAPIsBuilder; +import com.azure.resourcemanager.oep.implementation.OperationsImpl; +import com.azure.resourcemanager.oep.models.EnergyServices; +import com.azure.resourcemanager.oep.models.Locations; +import com.azure.resourcemanager.oep.models.Operations; +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 OepManager. Open Energy Platform Management Service APIs. */ +public final class OepManager { + private Locations locations; + + private EnergyServices energyServices; + + private Operations operations; + + private final OpenEnergyPlatformManagementServiceAPIs clientObject; + + private OepManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new OpenEnergyPlatformManagementServiceAPIsBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of oep service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the oep service API instance. + */ + public static OepManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create OepManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new OepManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private 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 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 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, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of oep service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the oep service API instance. + */ + public OepManager 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.oep") + .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) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + 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 OepManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Locations. */ + public Locations locations() { + if (this.locations == null) { + this.locations = new LocationsImpl(clientObject.getLocations(), this); + } + return locations; + } + + /** @return Resource collection API of EnergyServices. */ + public EnergyServices energyServices() { + if (this.energyServices == null) { + this.energyServices = new EnergyServicesImpl(clientObject.getEnergyServices(), this); + } + return energyServices; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * @return Wrapped service client OpenEnergyPlatformManagementServiceAPIs providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public OpenEnergyPlatformManagementServiceAPIs serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/EnergyServicesClient.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/EnergyServicesClient.java new file mode 100644 index 0000000000000..dc7f421a6bfa4 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/EnergyServicesClient.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.oep.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.oep.fluent.models.EnergyServiceInner; +import com.azure.resourcemanager.oep.models.EnergyResourceUpdate; + +/** An instance of this class provides access to all the operations defined in EnergyServicesClient. */ +public interface EnergyServicesClient { + /** + * Returns list of oep resources.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns list of oep resources.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists a collection of oep resources under the given Azure Subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists a collection of oep resources under the given Azure Subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Returns oep resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnergyServiceInner getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Returns oep resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnergyServiceInner> beginCreate( + String resourceGroupName, String resourceName, EnergyServiceInner body); + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnergyServiceInner> beginCreate( + String resourceGroupName, String resourceName, EnergyServiceInner body, Context context); + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnergyServiceInner create(String resourceGroupName, String resourceName, EnergyServiceInner body); + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnergyServiceInner create(String resourceGroupName, String resourceName); + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnergyServiceInner create(String resourceGroupName, String resourceName, EnergyServiceInner body, Context context); + + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnergyServiceInner update(String resourceGroupName, String resourceName); + + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body The resource model definition used for updating a tracked ARM resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String resourceName, EnergyResourceUpdate body, Context context); + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName); + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName, Context context); + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceName); + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceName, Context context); +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/LocationsClient.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/LocationsClient.java new file mode 100644 index 0000000000000..582673ead6e16 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/LocationsClient.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.oep.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.oep.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.oep.models.CheckNameAvailabilityRequest; + +/** An instance of this class provides access to all the operations defined in LocationsClient. */ +public interface LocationsClient { + /** + * Checks the name availability of the resource with requested resource name. + * + * @param body NameAvailabilityRequest object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResponseInner checkNameAvailability(CheckNameAvailabilityRequest body); + + /** + * Checks the name availability of the resource with requested resource name. + * + * @param body NameAvailabilityRequest object. + * @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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest body, Context context); +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/OpenEnergyPlatformManagementServiceAPIs.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/OpenEnergyPlatformManagementServiceAPIs.java new file mode 100644 index 0000000000000..d996e73d36e97 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/OpenEnergyPlatformManagementServiceAPIs.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.oep.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for OpenEnergyPlatformManagementServiceAPIs class. */ +public interface OpenEnergyPlatformManagementServiceAPIs { + /** + * 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 LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + LocationsClient getLocations(); + + /** + * Gets the EnergyServicesClient object to access its operations. + * + * @return the EnergyServicesClient object. + */ + EnergyServicesClient getEnergyServices(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/OperationsClient.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/OperationsClient.java new file mode 100644 index 0000000000000..27434386b12ae --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/OperationsClient.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.oep.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.oep.fluent.models.OperationListResultInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists the available operations of Microsoft.OpenEnergyPlatform resource provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationListResultInner list(); + + /** + * Lists the available operations of Microsoft.OpenEnergyPlatform resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/CheckNameAvailabilityResponseInner.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/CheckNameAvailabilityResponseInner.java new file mode 100644 index 0000000000000..5f3c36bb4c026 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/CheckNameAvailabilityResponseInner.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.oep.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.oep.models.CheckNameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The check availability result. */ +@Fluent +public final class CheckNameAvailabilityResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityResponseInner.class); + + /* + * Indicates if the resource name is available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * The reason why the given name is not available. + */ + @JsonProperty(value = "reason") + private CheckNameAvailabilityReason reason; + + /* + * Detailed reason why the given name is available. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Indicates if the resource name is available. + * + * @param nameAvailable the nameAvailable value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + + /** + * Set the reason property: The reason why the given name is not available. + * + * @param reason the reason value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withReason(CheckNameAvailabilityReason reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: Detailed reason why the given name is available. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Detailed reason why the given name is available. + * + * @param message the message value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/EnergyServiceInner.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/EnergyServiceInner.java new file mode 100644 index 0000000000000..438e1b1e7a173 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/EnergyServiceInner.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.oep.models.EnergyServiceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The EnergyService model. */ +@Fluent +public final class EnergyServiceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnergyServiceInner.class); + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private EnergyServiceProperties properties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Geo-location where the resource lives. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public EnergyServiceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the EnergyServiceInner object itself. + */ + public EnergyServiceInner withProperties(EnergyServiceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the EnergyServiceInner object itself. + */ + public EnergyServiceInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location property: Geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Geo-location where the resource lives. + * + * @param location the location value to set. + * @return the EnergyServiceInner object itself. + */ + public EnergyServiceInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property location in model EnergyServiceInner")); + } + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/OperationListResultInner.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/OperationListResultInner.java new file mode 100644 index 0000000000000..dade200583161 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/OperationListResultInner.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.oep.models.Operation; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 OperationListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResultInner.class); + + /* + * 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/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/package-info.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/models/package-info.java new file mode 100644 index 0000000000000..8adfeea7a0186 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/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 OpenEnergyPlatformManagementServiceAPIs. Open Energy Platform Management + * Service APIs. + */ +package com.azure.resourcemanager.oep.fluent.models; diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/package-info.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/fluent/package-info.java new file mode 100644 index 0000000000000..f3f6795e6ca82 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/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 OpenEnergyPlatformManagementServiceAPIs. Open Energy Platform Management + * Service APIs. + */ +package com.azure.resourcemanager.oep.fluent; diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/CheckNameAvailabilityResponseImpl.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 0000000000000..9ec742d5b8d09 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/CheckNameAvailabilityResponseImpl.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.oep.implementation; + +import com.azure.resourcemanager.oep.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.oep.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.oep.models.CheckNameAvailabilityResponse; + +public final class CheckNameAvailabilityResponseImpl implements CheckNameAvailabilityResponse { + private CheckNameAvailabilityResponseInner innerObject; + + private final com.azure.resourcemanager.oep.OepManager serviceManager; + + CheckNameAvailabilityResponseImpl( + CheckNameAvailabilityResponseInner innerObject, com.azure.resourcemanager.oep.OepManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public CheckNameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.oep.OepManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/EnergyServiceImpl.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/EnergyServiceImpl.java new file mode 100644 index 0000000000000..5610bda284da0 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/EnergyServiceImpl.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.oep.fluent.models.EnergyServiceInner; +import com.azure.resourcemanager.oep.models.EnergyResourceUpdate; +import com.azure.resourcemanager.oep.models.EnergyService; +import com.azure.resourcemanager.oep.models.EnergyServiceProperties; +import java.util.Collections; +import java.util.Map; + +public final class EnergyServiceImpl implements EnergyService, EnergyService.Definition, EnergyService.Update { + private EnergyServiceInner innerObject; + + private final com.azure.resourcemanager.oep.OepManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public EnergyServiceProperties properties() { + return this.innerModel().properties(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String location() { + return this.innerModel().location(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public EnergyServiceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.oep.OepManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceName; + + private EnergyResourceUpdate updateBody; + + public EnergyServiceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public EnergyService create() { + this.innerObject = + serviceManager + .serviceClient() + .getEnergyServices() + .create(resourceGroupName, resourceName, this.innerModel(), Context.NONE); + return this; + } + + public EnergyService create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEnergyServices() + .create(resourceGroupName, resourceName, this.innerModel(), context); + return this; + } + + EnergyServiceImpl(String name, com.azure.resourcemanager.oep.OepManager serviceManager) { + this.innerObject = new EnergyServiceInner(); + this.serviceManager = serviceManager; + this.resourceName = name; + } + + public EnergyServiceImpl update() { + this.updateBody = new EnergyResourceUpdate(); + return this; + } + + public EnergyService apply() { + this.innerObject = + serviceManager + .serviceClient() + .getEnergyServices() + .updateWithResponse(resourceGroupName, resourceName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public EnergyService apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEnergyServices() + .updateWithResponse(resourceGroupName, resourceName, updateBody, context) + .getValue(); + return this; + } + + EnergyServiceImpl(EnergyServiceInner innerObject, com.azure.resourcemanager.oep.OepManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceName = Utils.getValueFromIdByName(innerObject.id(), "energyServices"); + } + + public EnergyService refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getEnergyServices() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE) + .getValue(); + return this; + } + + public EnergyService refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEnergyServices() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, context) + .getValue(); + return this; + } + + public EnergyServiceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public EnergyServiceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public EnergyServiceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public EnergyServiceImpl withProperties(EnergyServiceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/EnergyServicesClientImpl.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/EnergyServicesClientImpl.java new file mode 100644 index 0000000000000..bbbc2fd04c327 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/EnergyServicesClientImpl.java @@ -0,0 +1,1466 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.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.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.oep.fluent.EnergyServicesClient; +import com.azure.resourcemanager.oep.fluent.models.EnergyServiceInner; +import com.azure.resourcemanager.oep.models.EnergyResourceUpdate; +import com.azure.resourcemanager.oep.models.EnergyServiceList; +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 EnergyServicesClient. */ +public final class EnergyServicesClientImpl implements EnergyServicesClient { + private final ClientLogger logger = new ClientLogger(EnergyServicesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final EnergyServicesService service; + + /** The service client containing this operation class. */ + private final OpenEnergyPlatformManagementServiceAPIsImpl client; + + /** + * Initializes an instance of EnergyServicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnergyServicesClientImpl(OpenEnergyPlatformManagementServiceAPIsImpl client) { + this.service = + RestProxy.create(EnergyServicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OpenEnergyPlatformManagementServiceAPIsEnergyServices to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OpenEnergyPlatformMa") + private interface EnergyServicesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform" + + "/energyServices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.OpenEnergyPlatform/energyServices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform" + + "/energyServices/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform" + + "/energyServices/{resourceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @BodyParam("application/json") EnergyServiceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform" + + "/energyServices/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") EnergyResourceUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform" + + "/energyServices/{resourceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns list of oep resources.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @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.getSubscriptionId(), + resourceGroupName, + 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())); + } + + /** + * Returns list of oep resources.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @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.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns list of oep resources.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Returns list of oep resources.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns list of oep resources.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Returns list of oep resources.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists a collection of oep resources under the given Azure Subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @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.getSubscriptionId(), + 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 a collection of oep resources under the given Azure Subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @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.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists a collection of oep resources under the given Azure Subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists a collection of oep resources under the given Azure Subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists a collection of oep resources under the given Azure Subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists a collection of oep resources under the given Azure Subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Returns oep resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns oep resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Returns oep resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns oep resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnergyServiceInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupAsync(resourceGroupName, resourceName).block(); + } + + /** + * Returns oep resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String resourceName, EnergyServiceInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String resourceName, EnergyServiceInner body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + body, + accept, + context); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EnergyServiceInner> beginCreateAsync( + String resourceGroupName, String resourceName, EnergyServiceInner body) { + Mono>> mono = createWithResponseAsync(resourceGroupName, resourceName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + EnergyServiceInner.class, + EnergyServiceInner.class, + this.client.getContext()); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EnergyServiceInner> beginCreateAsync( + String resourceGroupName, String resourceName, EnergyServiceInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createWithResponseAsync(resourceGroupName, resourceName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), EnergyServiceInner.class, EnergyServiceInner.class, context); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnergyServiceInner> beginCreate( + String resourceGroupName, String resourceName, EnergyServiceInner body) { + return beginCreateAsync(resourceGroupName, resourceName, body).getSyncPoller(); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnergyServiceInner> beginCreate( + String resourceGroupName, String resourceName, EnergyServiceInner body, Context context) { + return beginCreateAsync(resourceGroupName, resourceName, body, context).getSyncPoller(); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String resourceName, EnergyServiceInner body) { + return beginCreateAsync(resourceGroupName, resourceName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String resourceName) { + final EnergyServiceInner body = null; + return beginCreateAsync(resourceGroupName, resourceName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String resourceName, EnergyServiceInner body, Context context) { + return beginCreateAsync(resourceGroupName, resourceName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnergyServiceInner create(String resourceGroupName, String resourceName, EnergyServiceInner body) { + return createAsync(resourceGroupName, resourceName, body).block(); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnergyServiceInner create(String resourceGroupName, String resourceName) { + final EnergyServiceInner body = null; + return createAsync(resourceGroupName, resourceName, body).block(); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body Request body. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnergyServiceInner create( + String resourceGroupName, String resourceName, EnergyServiceInner body, Context context) { + return createAsync(resourceGroupName, resourceName, body, context).block(); + } + + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body The resource model definition used for updating a tracked ARM resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String resourceName, EnergyResourceUpdate body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body The resource model definition used for updating a tracked ARM resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String resourceName, EnergyResourceUpdate body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body The resource model definition used for updating a tracked ARM resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String resourceName, EnergyResourceUpdate body) { + return updateWithResponseAsync(resourceGroupName, resourceName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String resourceName) { + final EnergyResourceUpdate body = null; + return updateWithResponseAsync(resourceGroupName, resourceName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnergyServiceInner update(String resourceGroupName, String resourceName) { + final EnergyResourceUpdate body = null; + return updateAsync(resourceGroupName, resourceName, body).block(); + } + + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param body The resource model definition used for updating a tracked ARM resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String resourceName, EnergyResourceUpdate body, Context context) { + return updateWithResponseAsync(resourceGroupName, resourceName, body, context).block(); + } + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String resourceName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String resourceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String resourceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName) { + return beginDeleteAsync(resourceGroupName, resourceName).getSyncPoller(); + } + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String resourceName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceName, context).getSyncPoller(); + } + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceName) { + return beginDeleteAsync(resourceGroupName, resourceName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceName) { + deleteAsync(resourceGroupName, resourceName).block(); + } + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceName, Context context) { + deleteAsync(resourceGroupName, resourceName, 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 list of oep resources. + */ + @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 list of oep resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of oep resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of oep resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/EnergyServicesImpl.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/EnergyServicesImpl.java new file mode 100644 index 0000000000000..b1ae5dd0eae6d --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/EnergyServicesImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.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.oep.fluent.EnergyServicesClient; +import com.azure.resourcemanager.oep.fluent.models.EnergyServiceInner; +import com.azure.resourcemanager.oep.models.EnergyService; +import com.azure.resourcemanager.oep.models.EnergyServices; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class EnergyServicesImpl implements EnergyServices { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnergyServicesImpl.class); + + private final EnergyServicesClient innerClient; + + private final com.azure.resourcemanager.oep.OepManager serviceManager; + + public EnergyServicesImpl( + EnergyServicesClient innerClient, com.azure.resourcemanager.oep.OepManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new EnergyServiceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new EnergyServiceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new EnergyServiceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new EnergyServiceImpl(inner1, this.manager())); + } + + public EnergyService getByResourceGroup(String resourceGroupName, String resourceName) { + EnergyServiceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, resourceName); + if (inner != null) { + return new EnergyServiceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EnergyServiceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String resourceName) { + this.serviceClient().delete(resourceGroupName, resourceName); + } + + public void delete(String resourceGroupName, String resourceName, Context context) { + this.serviceClient().delete(resourceGroupName, resourceName, context); + } + + public EnergyService 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 resourceName = Utils.getValueFromIdByName(id, "energyServices"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'energyServices'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, 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 resourceName = Utils.getValueFromIdByName(id, "energyServices"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'energyServices'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "energyServices"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'energyServices'.", id))); + } + this.delete(resourceGroupName, resourceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "energyServices"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'energyServices'.", id))); + } + this.delete(resourceGroupName, resourceName, context); + } + + private EnergyServicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.oep.OepManager manager() { + return this.serviceManager; + } + + public EnergyServiceImpl define(String name) { + return new EnergyServiceImpl(name, this.manager()); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/LocationsClientImpl.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/LocationsClientImpl.java new file mode 100644 index 0000000000000..0888c0d402461 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/LocationsClientImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.oep.fluent.LocationsClient; +import com.azure.resourcemanager.oep.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.oep.models.CheckNameAvailabilityRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LocationsClient. */ +public final class LocationsClientImpl implements LocationsClient { + private final ClientLogger logger = new ClientLogger(LocationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LocationsService service; + + /** The service client containing this operation class. */ + private final OpenEnergyPlatformManagementServiceAPIsImpl client; + + /** + * Initializes an instance of LocationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LocationsClientImpl(OpenEnergyPlatformManagementServiceAPIsImpl client) { + this.service = + RestProxy.create(LocationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OpenEnergyPlatformManagementServiceAPIsLocations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OpenEnergyPlatformMa") + private interface LocationsService { + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.OpenEnergyPlatform/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CheckNameAvailabilityRequest body, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Checks the name availability of the resource with requested resource name. + * + * @param body NameAvailabilityRequest object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), this.client.getSubscriptionId(), body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks the name availability of the resource with requested resource name. + * + * @param body NameAvailabilityRequest object. + * @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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailability(this.client.getEndpoint(), this.client.getSubscriptionId(), body, accept, context); + } + + /** + * Checks the name availability of the resource with requested resource name. + * + * @param body NameAvailabilityRequest object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync(CheckNameAvailabilityRequest body) { + return checkNameAvailabilityWithResponseAsync(body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks the name availability of the resource with requested resource name. + * + * @param body NameAvailabilityRequest object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResponseInner checkNameAvailability(CheckNameAvailabilityRequest body) { + return checkNameAvailabilityAsync(body).block(); + } + + /** + * Checks the name availability of the resource with requested resource name. + * + * @param body NameAvailabilityRequest object. + * @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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest body, Context context) { + return checkNameAvailabilityWithResponseAsync(body, context).block(); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/LocationsImpl.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/LocationsImpl.java new file mode 100644 index 0000000000000..8795314cd6757 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/LocationsImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.oep.fluent.LocationsClient; +import com.azure.resourcemanager.oep.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.oep.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.oep.models.CheckNameAvailabilityResponse; +import com.azure.resourcemanager.oep.models.Locations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LocationsImpl implements Locations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationsImpl.class); + + private final LocationsClient innerClient; + + private final com.azure.resourcemanager.oep.OepManager serviceManager; + + public LocationsImpl(LocationsClient innerClient, com.azure.resourcemanager.oep.OepManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CheckNameAvailabilityResponse checkNameAvailability(CheckNameAvailabilityRequest body) { + CheckNameAvailabilityResponseInner inner = this.serviceClient().checkNameAvailability(body); + if (inner != null) { + return new CheckNameAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest body, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private LocationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.oep.OepManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OpenEnergyPlatformManagementServiceAPIsBuilder.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OpenEnergyPlatformManagementServiceAPIsBuilder.java new file mode 100644 index 0000000000000..f79576cbcc809 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OpenEnergyPlatformManagementServiceAPIsBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.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.CookiePolicy; +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 OpenEnergyPlatformManagementServiceAPIsImpl type. */ +@ServiceClientBuilder(serviceClients = {OpenEnergyPlatformManagementServiceAPIsImpl.class}) +public final class OpenEnergyPlatformManagementServiceAPIsBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the OpenEnergyPlatformManagementServiceAPIsBuilder. + */ + public OpenEnergyPlatformManagementServiceAPIsBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the OpenEnergyPlatformManagementServiceAPIsBuilder. + */ + public OpenEnergyPlatformManagementServiceAPIsBuilder 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 OpenEnergyPlatformManagementServiceAPIsBuilder. + */ + public OpenEnergyPlatformManagementServiceAPIsBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 OpenEnergyPlatformManagementServiceAPIsBuilder. + */ + public OpenEnergyPlatformManagementServiceAPIsBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 OpenEnergyPlatformManagementServiceAPIsBuilder. + */ + public OpenEnergyPlatformManagementServiceAPIsBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + 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 OpenEnergyPlatformManagementServiceAPIsBuilder. + */ + public OpenEnergyPlatformManagementServiceAPIsBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of OpenEnergyPlatformManagementServiceAPIsImpl with the provided parameters. + * + * @return an instance of OpenEnergyPlatformManagementServiceAPIsImpl. + */ + public OpenEnergyPlatformManagementServiceAPIsImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + OpenEnergyPlatformManagementServiceAPIsImpl client = + new OpenEnergyPlatformManagementServiceAPIsImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OpenEnergyPlatformManagementServiceAPIsImpl.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OpenEnergyPlatformManagementServiceAPIsImpl.java new file mode 100644 index 0000000000000..6b0b0dea4baef --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OpenEnergyPlatformManagementServiceAPIsImpl.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.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.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.oep.fluent.EnergyServicesClient; +import com.azure.resourcemanager.oep.fluent.LocationsClient; +import com.azure.resourcemanager.oep.fluent.OpenEnergyPlatformManagementServiceAPIs; +import com.azure.resourcemanager.oep.fluent.OperationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the OpenEnergyPlatformManagementServiceAPIsImpl type. */ +@ServiceClient(builder = OpenEnergyPlatformManagementServiceAPIsBuilder.class) +public final class OpenEnergyPlatformManagementServiceAPIsImpl implements OpenEnergyPlatformManagementServiceAPIs { + private final ClientLogger logger = new ClientLogger(OpenEnergyPlatformManagementServiceAPIsImpl.class); + + /** 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 LocationsClient object to access its operations. */ + private final LocationsClient locations; + + /** + * Gets the LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + public LocationsClient getLocations() { + return this.locations; + } + + /** The EnergyServicesClient object to access its operations. */ + private final EnergyServicesClient energyServices; + + /** + * Gets the EnergyServicesClient object to access its operations. + * + * @return the EnergyServicesClient object. + */ + public EnergyServicesClient getEnergyServices() { + return this.energyServices; + } + + /** 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; + } + + /** + * Initializes an instance of OpenEnergyPlatformManagementServiceAPIs 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. + */ + OpenEnergyPlatformManagementServiceAPIsImpl( + 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-06-01-preview"; + this.locations = new LocationsClientImpl(this); + this.energyServices = new EnergyServicesClientImpl(this); + this.operations = new OperationsClientImpl(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) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return 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)); + } + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OperationListResultImpl.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OperationListResultImpl.java new file mode 100644 index 0000000000000..f9cbcb7a7a7e8 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OperationListResultImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.implementation; + +import com.azure.resourcemanager.oep.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.oep.models.Operation; +import com.azure.resourcemanager.oep.models.OperationListResult; +import java.util.Collections; +import java.util.List; + +public final class OperationListResultImpl implements OperationListResult { + private OperationListResultInner innerObject; + + private final com.azure.resourcemanager.oep.OepManager serviceManager; + + OperationListResultImpl( + OperationListResultInner innerObject, com.azure.resourcemanager.oep.OepManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public OperationListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.oep.OepManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OperationsClientImpl.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..c0fe6126cbcff --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OperationsClientImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.oep.fluent.OperationsClient; +import com.azure.resourcemanager.oep.fluent.models.OperationListResultInner; +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 { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final OpenEnergyPlatformManagementServiceAPIsImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(OpenEnergyPlatformManagementServiceAPIsImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OpenEnergyPlatformManagementServiceAPIsOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OpenEnergyPlatformMa") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.OpenEnergyPlatform/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the available operations of Microsoft.OpenEnergyPlatform resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + 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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the available operations of Microsoft.OpenEnergyPlatform resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(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); + } + + /** + * Lists the available operations of Microsoft.OpenEnergyPlatform resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the available operations of Microsoft.OpenEnergyPlatform resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationListResultInner list() { + return listAsync().block(); + } + + /** + * Lists the available operations of Microsoft.OpenEnergyPlatform resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OperationsImpl.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..1edba0bebd6c3 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/OperationsImpl.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.oep.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.oep.fluent.OperationsClient; +import com.azure.resourcemanager.oep.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.oep.models.OperationListResult; +import com.azure.resourcemanager.oep.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.oep.OepManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.oep.OepManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationListResult list() { + OperationListResultInner inner = this.serviceClient().list(); + if (inner != null) { + return new OperationListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.oep.OepManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/Utils.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/Utils.java new file mode 100644 index 0000000000000..644b769a0b4c4 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/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.oep.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/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/package-info.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/package-info.java new file mode 100644 index 0000000000000..a7f10aebc0683 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/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 OpenEnergyPlatformManagementServiceAPIs. Open Energy Platform Management + * Service APIs. + */ +package com.azure.resourcemanager.oep.implementation; diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/ActionType.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/ActionType.java new file mode 100644 index 0000000000000..8a52e5bc32bd1 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/ActionType.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.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); + } + + /** @return known ActionType values. */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/CheckNameAvailabilityReason.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/CheckNameAvailabilityReason.java new file mode 100644 index 0000000000000..e107036667f6b --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/CheckNameAvailabilityReason.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CheckNameAvailabilityReason. */ +public final class CheckNameAvailabilityReason extends ExpandableStringEnum { + /** Static value Invalid for CheckNameAvailabilityReason. */ + public static final CheckNameAvailabilityReason INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for CheckNameAvailabilityReason. */ + public static final CheckNameAvailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates or finds a CheckNameAvailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding CheckNameAvailabilityReason. + */ + @JsonCreator + public static CheckNameAvailabilityReason fromString(String name) { + return fromString(name, CheckNameAvailabilityReason.class); + } + + /** @return known CheckNameAvailabilityReason values. */ + public static Collection values() { + return values(CheckNameAvailabilityReason.class); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/CheckNameAvailabilityRequest.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..f19c8e069a520 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/CheckNameAvailabilityRequest.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.oep.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The check availability request body. */ +@Fluent +public final class CheckNameAvailabilityRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityRequest.class); + + /* + * The name of the resource for which availability needs to be checked. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The resource type. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the name property: The name of the resource for which availability needs to be checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource for which availability needs to be checked. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/CheckNameAvailabilityResponse.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/CheckNameAvailabilityResponse.java new file mode 100644 index 0000000000000..e82e5a6d18d34 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/CheckNameAvailabilityResponse.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.oep.models; + +import com.azure.resourcemanager.oep.fluent.models.CheckNameAvailabilityResponseInner; + +/** An immutable client-side representation of CheckNameAvailabilityResponse. */ +public interface CheckNameAvailabilityResponse { + /** + * Gets the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + + /** + * Gets the message property: Detailed reason why the given name is available. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.oep.fluent.models.CheckNameAvailabilityResponseInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResponseInner innerModel(); +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/DataPartitionNames.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/DataPartitionNames.java new file mode 100644 index 0000000000000..66b26812d991e --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/DataPartitionNames.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.oep.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The list of Energy services resource's Data Partition Names. */ +@Fluent +public final class DataPartitionNames { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataPartitionNames.class); + + /* + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the DataPartitionNames object itself. + */ + public DataPartitionNames 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/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyResourceUpdate.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyResourceUpdate.java new file mode 100644 index 0000000000000..572668476a3d9 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyResourceUpdate.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.oep.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The resource model definition used for updating a tracked ARM resource. */ +@Fluent +public final class EnergyResourceUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnergyResourceUpdate.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the EnergyResourceUpdate object itself. + */ + public EnergyResourceUpdate 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/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyService.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyService.java new file mode 100644 index 0000000000000..7d28f66743a90 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyService.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.oep.fluent.models.EnergyServiceInner; +import java.util.Map; + +/** An immutable client-side representation of EnergyService. */ +public interface EnergyService { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The properties property. + * + * @return the properties value. + */ + EnergyServiceProperties properties(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the location property: Geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.oep.fluent.models.EnergyServiceInner object. + * + * @return the inner object. + */ + EnergyServiceInner innerModel(); + + /** The entirety of the EnergyService definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The EnergyService definition stages. */ + interface DefinitionStages { + /** The first stage of the EnergyService definition. */ + interface Blank extends WithLocation { + } + /** The stage of the EnergyService definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location Geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location Geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the EnergyService 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 EnergyService definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + EnergyService create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + EnergyService create(Context context); + } + /** The stage of the EnergyService 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 EnergyService definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties property.. + * + * @param properties The properties property. + * @return the next definition stage. + */ + WithCreate withProperties(EnergyServiceProperties properties); + } + } + /** + * Begins update for the EnergyService resource. + * + * @return the stage of resource update. + */ + EnergyService.Update update(); + + /** The template for EnergyService update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + EnergyService apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + EnergyService apply(Context context); + } + /** The EnergyService update stages. */ + interface UpdateStages { + /** The stage of the EnergyService update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + EnergyService refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + EnergyService refresh(Context context); +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyServiceList.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyServiceList.java new file mode 100644 index 0000000000000..4c27b6844871f --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyServiceList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.oep.fluent.models.EnergyServiceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of oep resources. */ +@Fluent +public final class EnergyServiceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnergyServiceList.class); + + /* + * The link used to get the next page of oep resources list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * The list of oep resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the nextLink property: The link used to get the next page of oep resources list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of oep resources list. + * + * @param nextLink the nextLink value to set. + * @return the EnergyServiceList object itself. + */ + public EnergyServiceList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: The list of oep resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of oep resources. + * + * @param value the value value to set. + * @return the EnergyServiceList object itself. + */ + public EnergyServiceList withValue(List value) { + this.value = value; + 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/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyServiceProperties.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyServiceProperties.java new file mode 100644 index 0000000000000..1257818aebb29 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyServiceProperties.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The EnergyServiceProperties model. */ +@Fluent +public final class EnergyServiceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnergyServiceProperties.class); + + /* + * The dnsName property. + */ + @JsonProperty(value = "dnsName", access = JsonProperty.Access.WRITE_ONLY) + private String dnsName; + + /* + * The provisioningState property. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The authAppId property. + */ + @JsonProperty(value = "authAppId") + private String authAppId; + + /* + * The dataPartitionNames property. + */ + @JsonProperty(value = "dataPartitionNames") + private List dataPartitionNames; + + /** + * Get the dnsName property: The dnsName property. + * + * @return the dnsName value. + */ + public String dnsName() { + return this.dnsName; + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the authAppId property: The authAppId property. + * + * @return the authAppId value. + */ + public String authAppId() { + return this.authAppId; + } + + /** + * Set the authAppId property: The authAppId property. + * + * @param authAppId the authAppId value to set. + * @return the EnergyServiceProperties object itself. + */ + public EnergyServiceProperties withAuthAppId(String authAppId) { + this.authAppId = authAppId; + return this; + } + + /** + * Get the dataPartitionNames property: The dataPartitionNames property. + * + * @return the dataPartitionNames value. + */ + public List dataPartitionNames() { + return this.dataPartitionNames; + } + + /** + * Set the dataPartitionNames property: The dataPartitionNames property. + * + * @param dataPartitionNames the dataPartitionNames value to set. + * @return the EnergyServiceProperties object itself. + */ + public EnergyServiceProperties withDataPartitionNames(List dataPartitionNames) { + this.dataPartitionNames = dataPartitionNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dataPartitionNames() != null) { + dataPartitionNames().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyServices.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyServices.java new file mode 100644 index 0000000000000..807d728dbe620 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/EnergyServices.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.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 EnergyServices. */ +public interface EnergyServices { + /** + * Returns list of oep resources.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns list of oep resources.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists a collection of oep resources under the given Azure Subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + PagedIterable list(); + + /** + * Lists a collection of oep resources under the given Azure Subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of oep resources. + */ + PagedIterable list(Context context); + + /** + * Returns oep resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + EnergyService getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Returns oep resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Deletes oep resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String resourceName, Context context); + + /** + * Returns oep resource for a given 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 response. + */ + EnergyService getById(String id); + + /** + * Returns oep resource for a given 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 response. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes oep resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes oep resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new EnergyService resource. + * + * @param name resource name. + * @return the first stage of the new EnergyService definition. + */ + EnergyService.DefinitionStages.Blank define(String name); +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Locations.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Locations.java new file mode 100644 index 0000000000000..bb0ff89c5c21b --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Locations.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.oep.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Locations. */ +public interface Locations { + /** + * Checks the name availability of the resource with requested resource name. + * + * @param body NameAvailabilityRequest object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + CheckNameAvailabilityResponse checkNameAvailability(CheckNameAvailabilityRequest body); + + /** + * Checks the name availability of the resource with requested resource name. + * + * @param body NameAvailabilityRequest object. + * @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 check availability result. + */ + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest body, Context context); +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Operation.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Operation.java new file mode 100644 index 0000000000000..9bc6f8638fcd2 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Operation.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 Operation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Operation.class); + + /* + * 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 Operation object itself. + */ + public Operation 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/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/OperationDisplay.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/OperationDisplay.java new file mode 100644 index 0000000000000..8c8f57421e243 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/OperationDisplay.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * 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/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/OperationListResult.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/OperationListResult.java new file mode 100644 index 0000000000000..bdf27a24a80d7 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/OperationListResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.models; + +import com.azure.resourcemanager.oep.fluent.models.OperationListResultInner; +import java.util.List; + +/** An immutable client-side representation of OperationListResult. */ +public interface OperationListResult { + /** + * Gets the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.oep.fluent.models.OperationListResultInner object. + * + * @return the inner object. + */ + OperationListResultInner innerModel(); +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Operations.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Operations.java new file mode 100644 index 0000000000000..cdd370b6f7e89 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists the available operations of Microsoft.OpenEnergyPlatform resource provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + OperationListResult list(); + + /** + * Lists the available operations of Microsoft.OpenEnergyPlatform resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + Response listWithResponse(Context context); +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Origin.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Origin.java new file mode 100644 index 0000000000000..8e982352404ec --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/Origin.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.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); + } + + /** @return known Origin values. */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/ProvisioningState.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/ProvisioningState.java new file mode 100644 index 0000000000000..4ceed121388d3 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/ProvisioningState.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.oep.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Unknown for ProvisioningState. */ + public static final ProvisioningState UNKNOWN = fromString("Unknown"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/package-info.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/models/package-info.java new file mode 100644 index 0000000000000..528b6bd7f8806 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/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 OpenEnergyPlatformManagementServiceAPIs. Open Energy Platform Management + * Service APIs. + */ +package com.azure.resourcemanager.oep.models; diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/package-info.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/package-info.java new file mode 100644 index 0000000000000..d7eb90d8db28d --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/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 classes for OpenEnergyPlatformManagementServiceAPIs. Open Energy Platform Management Service + * APIs. + */ +package com.azure.resourcemanager.oep; diff --git a/sdk/oep/azure-resourcemanager-oep/src/main/java/module-info.java b/sdk/oep/azure-resourcemanager-oep/src/main/java/module-info.java new file mode 100644 index 0000000000000..78252ffd502c1 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/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.oep { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.oep; + exports com.azure.resourcemanager.oep.fluent; + exports com.azure.resourcemanager.oep.fluent.models; + exports com.azure.resourcemanager.oep.models; + + opens com.azure.resourcemanager.oep.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.oep.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesCreateSamples.java b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesCreateSamples.java new file mode 100644 index 0000000000000..976a1b1ba9493 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesCreateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.generated; + +/** Samples for EnergyServices Create. */ +public final class EnergyServicesCreateSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/OepResource_Create.json + */ + /** + * Sample code: OepResource_Create. + * + * @param manager Entry point to OepManager. + */ + public static void oepResourceCreate(com.azure.resourcemanager.oep.OepManager manager) { + manager + .energyServices() + .define("DummyResourceName") + .withRegion((String) null) + .withExistingResourceGroup("DummyResourceGroupName") + .create(); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesDeleteSamples.java b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesDeleteSamples.java new file mode 100644 index 0000000000000..523a2c61deb7a --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesDeleteSamples.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.oep.generated; + +import com.azure.core.util.Context; + +/** Samples for EnergyServices Delete. */ +public final class EnergyServicesDeleteSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/OepResource_Delete.json + */ + /** + * Sample code: OepResource_Delete. + * + * @param manager Entry point to OepManager. + */ + public static void oepResourceDelete(com.azure.resourcemanager.oep.OepManager manager) { + manager.energyServices().delete("DummyResourceGroupName", "DummyResourceName", Context.NONE); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesGetByResourceGroupSamples.java b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..d8a79bb125539 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.generated; + +import com.azure.core.util.Context; + +/** Samples for EnergyServices GetByResourceGroup. */ +public final class EnergyServicesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/OepResource_Get.json + */ + /** + * Sample code: OepResource_Get. + * + * @param manager Entry point to OepManager. + */ + public static void oepResourceGet(com.azure.resourcemanager.oep.OepManager manager) { + manager + .energyServices() + .getByResourceGroupWithResponse("DummyResourceGroupName", "DummyResourceName", Context.NONE); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesListByResourceGroupSamples.java b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..e49aadad188af --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesListByResourceGroupSamples.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.oep.generated; + +import com.azure.core.util.Context; + +/** Samples for EnergyServices ListByResourceGroup. */ +public final class EnergyServicesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/OepResource_ListByResourceGroup.json + */ + /** + * Sample code: OepResource_ListByResourceGroup. + * + * @param manager Entry point to OepManager. + */ + public static void oepResourceListByResourceGroup(com.azure.resourcemanager.oep.OepManager manager) { + manager.energyServices().listByResourceGroup("DummyResourceGroupName", Context.NONE); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesListSamples.java b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesListSamples.java new file mode 100644 index 0000000000000..064be2b83f40e --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesListSamples.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.oep.generated; + +import com.azure.core.util.Context; + +/** Samples for EnergyServices List. */ +public final class EnergyServicesListSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/OepResource_ListBySubscriptionId.json + */ + /** + * Sample code: OepResource_ListBySubscriptionId. + * + * @param manager Entry point to OepManager. + */ + public static void oepResourceListBySubscriptionId(com.azure.resourcemanager.oep.OepManager manager) { + manager.energyServices().list(Context.NONE); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesUpdateSamples.java b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesUpdateSamples.java new file mode 100644 index 0000000000000..baa8add944ee6 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/EnergyServicesUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.oep.models.EnergyService; + +/** Samples for EnergyServices Update. */ +public final class EnergyServicesUpdateSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/OepResource_Update.json + */ + /** + * Sample code: OepResource_Update. + * + * @param manager Entry point to OepManager. + */ + public static void oepResourceUpdate(com.azure.resourcemanager.oep.OepManager manager) { + EnergyService resource = + manager + .energyServices() + .getByResourceGroupWithResponse("DummyResourceGroupName", "DummyResourceName", Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/LocationsCheckNameAvailabilitySamples.java b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/LocationsCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..733c78ea8e71f --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/LocationsCheckNameAvailabilitySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.oep.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.oep.models.CheckNameAvailabilityRequest; + +/** Samples for Locations CheckNameAvailability. */ +public final class LocationsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/Locations_CheckNameAvailability.json + */ + /** + * Sample code: Locations_CheckNameAvailability. + * + * @param manager Entry point to OepManager. + */ + public static void locationsCheckNameAvailability(com.azure.resourcemanager.oep.OepManager manager) { + manager + .locations() + .checkNameAvailabilityWithResponse( + new CheckNameAvailabilityRequest().withName("sample-name").withType("Microsoft.OEP/oepResource"), + Context.NONE); + } +} diff --git a/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/OperationsListSamples.java b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..78c514c48faa7 --- /dev/null +++ b/sdk/oep/azure-resourcemanager-oep/src/samples/java/com/azure/resourcemanager/oep/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.oep.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/oep/resource-manager/Microsoft.OpenEnergyPlatform/preview/2021-06-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to OepManager. + */ + public static void operationsList(com.azure.resourcemanager.oep.OepManager manager) { + manager.operations().listWithResponse(Context.NONE); + } +} diff --git a/sdk/oep/ci.yml b/sdk/oep/ci.yml new file mode 100644 index 0000000000000..dd212408166ea --- /dev/null +++ b/sdk/oep/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/oep/ci.yml + - sdk/oep/azure-resourcemanager-oep/ + exclude: + - sdk/oep/pom.xml + - sdk/oep/azure-resourcemanager-oep/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/oep/ci.yml + - sdk/oep/azure-resourcemanager-oep/ + exclude: + - sdk/oep/pom.xml + - sdk/oep/azure-resourcemanager-oep/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: oep + Artifacts: + - name: azure-resourcemanager-oep + groupId: com.azure.resourcemanager + safeName: azureresourcemanageroep diff --git a/sdk/oep/pom.xml b/sdk/oep/pom.xml new file mode 100644 index 0000000000000..a6a9de43f04e3 --- /dev/null +++ b/sdk/oep/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-oep-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-oep + + + +