From b6d2254205657dff3c79b01c995ceaf1df9a168c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 24 Apr 2023 08:02:35 +0000 Subject: [PATCH] CodeGen from PR 2594 in test-repo-billy/azure-rest-api-specs Merge fda03acb3594cdd152e50146045adcf588b8c6cf into 9a46bdbfea7730a3521ac11f5ea1120007d67f79 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 105 + .../SAMPLE.md | 366 ++++ .../azure-resourcemanager-hybridcloud/pom.xml | 61 + .../hybridcloud/HybridCloudManager.java | 314 +++ .../fluent/CloudConnectionsClient.java | 244 +++ .../fluent/CloudConnectorsClient.java | 297 +++ .../hybridcloud/fluent/HybridCloudClient.java | 67 + .../fluent/HybridCloudsClient.java | 38 + .../fluent/models/CloudConnectionInner.java | 192 ++ .../models/CloudConnectionProperties.java | 151 ++ .../fluent/models/CloudConnectorInner.java | 146 ++ .../models/CloudConnectorProperties.java | 93 + .../models/DiscoveredResourcesInner.java | 165 ++ .../fluent/models/OperationInner.java | 127 ++ .../fluent/models/ResourceFilter.java | 128 ++ .../fluent/models/package-info.java | 6 + .../hybridcloud/fluent/package-info.java | 6 + .../implementation/CloudConnectionImpl.java | 227 +++ .../CloudConnectionsClientImpl.java | 1461 ++++++++++++++ .../implementation/CloudConnectionsImpl.java | 178 ++ .../implementation/CloudConnectorImpl.java | 218 +++ .../CloudConnectorsClientImpl.java | 1717 +++++++++++++++++ .../implementation/CloudConnectorsImpl.java | 194 ++ .../DiscoveredResourcesImpl.java | 56 + .../HybridCloudClientBuilder.java | 144 ++ .../implementation/HybridCloudClientImpl.java | 318 +++ .../HybridCloudsClientImpl.java | 180 ++ .../implementation/HybridCloudsImpl.java | 45 + .../implementation/OperationImpl.java | 50 + .../hybridcloud/implementation/Utils.java | 204 ++ .../implementation/package-info.java | 6 + .../hybridcloud/models/ActionType.java | 44 + .../hybridcloud/models/BodyContentType.java | 47 + .../hybridcloud/models/CloudConnection.java | 294 +++ .../models/CloudConnectionListResult.java | 81 + .../hybridcloud/models/CloudConnections.java | 156 ++ .../hybridcloud/models/CloudConnector.java | 276 +++ .../models/CloudConnectorListResult.java | 81 + .../hybridcloud/models/CloudConnectors.java | 181 ++ .../hybridcloud/models/CloudType.java | 44 + .../models/DiscoveredResource.java | 69 + .../models/DiscoveredResources.java | 53 + .../hybridcloud/models/HybridClouds.java | 33 + .../hybridcloud/models/Operation.java | 56 + .../hybridcloud/models/OperationDisplay.java | 91 + .../models/OperationListResult.java | 62 + .../hybridcloud/models/Origin.java | 53 + .../hybridcloud/models/ProvisioningState.java | 56 + .../hybridcloud/models/ResourceReference.java | 50 + .../hybridcloud/models/TagsObject.java | 53 + .../hybridcloud/models/package-info.java | 6 + .../hybridcloud/package-info.java | 6 + .../src/main/java/module-info.java | 19 + ...CloudConnectionsCreateOrUpdateSamples.java | 37 + .../CloudConnectionsDeleteSamples.java | 20 + ...dConnectionsGetByResourceGroupSamples.java | 22 + ...ConnectionsListByResourceGroupSamples.java | 21 + .../CloudConnectionsListSamples.java | 21 + .../CloudConnectionsUpdateTagsSamples.java | 40 + .../CloudConnectorsCreateOrUpdateSamples.java | 29 + .../CloudConnectorsDeleteSamples.java | 20 + ...oudConnectorsDiscoverResourcesSamples.java | 21 + ...udConnectorsGetByResourceGroupSamples.java | 22 + ...dConnectorsListByResourceGroupSamples.java | 21 + .../generated/CloudConnectorsListSamples.java | 21 + .../CloudConnectorsUpdateTagsSamples.java | 40 + .../HybridCloudListOperationsSamples.java | 20 + sdk/hybridcloud/ci.yml | 47 + sdk/hybridcloud/pom.xml | 15 + 72 files changed, 9739 insertions(+) create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/CHANGELOG.md create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/README.md create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/SAMPLE.md create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/pom.xml create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/HybridCloudManager.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/CloudConnectionsClient.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/CloudConnectorsClient.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/HybridCloudClient.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/HybridCloudsClient.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectionInner.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectionProperties.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectorInner.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectorProperties.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/DiscoveredResourcesInner.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/OperationInner.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/ResourceFilter.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/package-info.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/package-info.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectionImpl.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectionsClientImpl.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectionsImpl.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectorImpl.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectorsClientImpl.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectorsImpl.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/DiscoveredResourcesImpl.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudClientBuilder.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudClientImpl.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudsClientImpl.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudsImpl.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/OperationImpl.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/Utils.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/package-info.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/ActionType.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/BodyContentType.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnection.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnectionListResult.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnections.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnector.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnectorListResult.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnectors.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudType.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/DiscoveredResource.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/DiscoveredResources.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/HybridClouds.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/Operation.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/OperationDisplay.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/OperationListResult.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/Origin.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/ProvisioningState.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/ResourceReference.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/TagsObject.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/package-info.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/package-info.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/module-info.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsCreateOrUpdateSamples.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsDeleteSamples.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsGetByResourceGroupSamples.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsListByResourceGroupSamples.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsListSamples.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsUpdateTagsSamples.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsCreateOrUpdateSamples.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsDeleteSamples.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsDiscoverResourcesSamples.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsGetByResourceGroupSamples.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsListByResourceGroupSamples.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsListSamples.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsUpdateTagsSamples.java create mode 100644 sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/HybridCloudListOperationsSamples.java create mode 100644 sdk/hybridcloud/ci.yml create mode 100644 sdk/hybridcloud/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 3cca56ef5a20..cb651259016f 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -409,6 +409,7 @@ com.azure.resourcemanager:azure-resourcemanager-graphservices;1.0.0-beta.1;1.0.0 com.azure.resourcemanager:azure-resourcemanager-paloaltonetworks-ngfw;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-qumulo;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-hybridcloud;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index f893e1394407..fdcd6f1f0d72 100644 --- a/pom.xml +++ b/pom.xml @@ -89,6 +89,7 @@ sdk/healthbot sdk/healthcareapis sdk/healthinsights + sdk/hybridcloud sdk/hybridcompute sdk/hybridcontainerservice sdk/hybridkubernetes diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/CHANGELOG.md b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/CHANGELOG.md new file mode 100644 index 000000000000..674522be7ca2 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-04-24) + +- Azure Resource Manager HybridCloud client library for Java. This package contains Microsoft Azure SDK for HybridCloud Management SDK. Hybrid cloud connectivity Management API. Package tag package-2023-01-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/hybridcloud/azure-resourcemanager-hybridcloud/README.md b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/README.md new file mode 100644 index 000000000000..de7e7feaffdc --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager HybridCloud client library for Java + +Azure Resource Manager HybridCloud client library for Java. + +This package contains Microsoft Azure SDK for HybridCloud Management SDK. Hybrid cloud connectivity Management API. Package tag package-2023-01-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-hybridcloud;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-hybridcloud + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +HybridCloudManager manager = HybridCloudManager + .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/hybridcloud/azure-resourcemanager-hybridcloud/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/SAMPLE.md b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/SAMPLE.md new file mode 100644 index 000000000000..7a5ce184cd48 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/SAMPLE.md @@ -0,0 +1,366 @@ +# Code snippets and samples + + +## CloudConnections + +- [CreateOrUpdate](#cloudconnections_createorupdate) +- [Delete](#cloudconnections_delete) +- [GetByResourceGroup](#cloudconnections_getbyresourcegroup) +- [List](#cloudconnections_list) +- [ListByResourceGroup](#cloudconnections_listbyresourcegroup) +- [UpdateTags](#cloudconnections_updatetags) + +## CloudConnectors + +- [CreateOrUpdate](#cloudconnectors_createorupdate) +- [Delete](#cloudconnectors_delete) +- [DiscoverResources](#cloudconnectors_discoverresources) +- [GetByResourceGroup](#cloudconnectors_getbyresourcegroup) +- [List](#cloudconnectors_list) +- [ListByResourceGroup](#cloudconnectors_listbyresourcegroup) +- [UpdateTags](#cloudconnectors_updatetags) + +## HybridCloud + +- [ListOperations](#hybridcloud_listoperations) +### CloudConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.hybridcloud.models.ResourceReference; + +/** Samples for CloudConnections CreateOrUpdate. */ +public final class CloudConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectionCreate.json + */ + /** + * Sample code: Create a Cloud Connection. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void createACloudConnection(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager + .cloudConnections() + .define("cloudconnection1") + .withRegion("West US") + .withExistingResourceGroup("demo-rg") + .withCloudConnector( + new ResourceReference() + .withId( + "/subscriptions/subid/resourceGroups/demo-rg/providers/Microsoft.HybridCloud/cloudConnectors/123456789012")) + .withRemoteResourceId("arn:aws:ec2:us-east-1:123456789012:VPNGateway/vgw-043da592550819c8a") + .withVirtualHub( + new ResourceReference() + .withId( + "/subscriptions/subid/resourceGroups/demo-rg/providers/Microsoft.Network/VirtualHubs/testHub")) + .withSharedKey("password123") + .create(); + } +} +``` + +### CloudConnections_Delete + +```java +/** Samples for CloudConnections Delete. */ +public final class CloudConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectionDelete.json + */ + /** + * Sample code: Delete Cloud Connection. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void deleteCloudConnection(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnections().delete("demo-rg", "cloudconnection1", com.azure.core.util.Context.NONE); + } +} +``` + +### CloudConnections_GetByResourceGroup + +```java +/** Samples for CloudConnections GetByResourceGroup. */ +public final class CloudConnectionsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectionGet.json + */ + /** + * Sample code: Get Cloud Connection. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void getCloudConnection(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager + .cloudConnections() + .getByResourceGroupWithResponse("demo-rg", "cloudConnection1", com.azure.core.util.Context.NONE); + } +} +``` + +### CloudConnections_List + +```java +/** Samples for CloudConnections List. */ +public final class CloudConnectionsListSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectionsBySubscriptionList.json + */ + /** + * Sample code: List of Cloud Connections by Subscription. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void listOfCloudConnectionsBySubscription( + com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnections().list(com.azure.core.util.Context.NONE); + } +} +``` + +### CloudConnections_ListByResourceGroup + +```java +/** Samples for CloudConnections ListByResourceGroup. */ +public final class CloudConnectionsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectionsByResourceGroupList.json + */ + /** + * Sample code: List of Cloud Connections by ResourceGroup. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void listOfCloudConnectionsByResourceGroup( + com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnections().listByResourceGroup("demo-rg", com.azure.core.util.Context.NONE); + } +} +``` + +### CloudConnections_UpdateTags + +```java +import com.azure.resourcemanager.hybridcloud.models.CloudConnection; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CloudConnections UpdateTags. */ +public final class CloudConnectionsUpdateTagsSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectionUpdateTags.json + */ + /** + * Sample code: Update Cloud Connections tags. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void updateCloudConnectionsTags(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + CloudConnection resource = + manager + .cloudConnections() + .getByResourceGroupWithResponse("demo-rg", "cloudConnection1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "value1", "key2", "value2")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### CloudConnectors_CreateOrUpdate + +```java +import com.azure.resourcemanager.hybridcloud.models.CloudType; + +/** Samples for CloudConnectors CreateOrUpdate. */ +public final class CloudConnectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorCreate.json + */ + /** + * Sample code: Create a Cloud Connector. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void createACloudConnector(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager + .cloudConnectors() + .define("123456789012") + .withRegion("West US") + .withExistingResourceGroup("demo-rg") + .withAccountId("123456789012") + .withCloudType(CloudType.AWS) + .create(); + } +} +``` + +### CloudConnectors_Delete + +```java +/** Samples for CloudConnectors Delete. */ +public final class CloudConnectorsDeleteSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorDelete.json + */ + /** + * Sample code: Delete Cloud Connector. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void deleteCloudConnector(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnectors().delete("demo-rg", "123456789012", com.azure.core.util.Context.NONE); + } +} +``` + +### CloudConnectors_DiscoverResources + +```java +/** Samples for CloudConnectors DiscoverResources. */ +public final class CloudConnectorsDiscoverResourcesSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorDiscoverResources.json + */ + /** + * Sample code: Get remote cloud resources by Cloud Connector. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void getRemoteCloudResourcesByCloudConnector( + com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnectors().discoverResources("demo-rg", "123456789012", com.azure.core.util.Context.NONE); + } +} +``` + +### CloudConnectors_GetByResourceGroup + +```java +/** Samples for CloudConnectors GetByResourceGroup. */ +public final class CloudConnectorsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorGet.json + */ + /** + * Sample code: Get Cloud Connector. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void getCloudConnector(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager + .cloudConnectors() + .getByResourceGroupWithResponse("demo-rg", "123456789012", com.azure.core.util.Context.NONE); + } +} +``` + +### CloudConnectors_List + +```java +/** Samples for CloudConnectors List. */ +public final class CloudConnectorsListSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorsBySubscriptionList.json + */ + /** + * Sample code: List of Cloud Connectors by Subscription. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void listOfCloudConnectorsBySubscription( + com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnectors().list(com.azure.core.util.Context.NONE); + } +} +``` + +### CloudConnectors_ListByResourceGroup + +```java +/** Samples for CloudConnectors ListByResourceGroup. */ +public final class CloudConnectorsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorsByResourceGroupList.json + */ + /** + * Sample code: List of Cloud Connectors by ResourceGroup. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void listOfCloudConnectorsByResourceGroup( + com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnectors().listByResourceGroup("demo-rg", com.azure.core.util.Context.NONE); + } +} +``` + +### CloudConnectors_UpdateTags + +```java +import com.azure.resourcemanager.hybridcloud.models.CloudConnector; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CloudConnectors UpdateTags. */ +public final class CloudConnectorsUpdateTagsSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorUpdateTags.json + */ + /** + * Sample code: Update Cloud Connector tags. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void updateCloudConnectorTags(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + CloudConnector resource = + manager + .cloudConnectors() + .getByResourceGroupWithResponse("demo-rg", "123456789012", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "value1", "key2", "value2")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### HybridCloud_ListOperations + +```java +/** Samples for HybridCloud ListOperations. */ +public final class HybridCloudListOperationsSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/OperationGroupGet.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void operationsList(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.hybridClouds().listOperations(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/pom.xml b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/pom.xml new file mode 100644 index 000000000000..d8a1ff930135 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-hybridcloud + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for HybridCloud Management + This package contains Microsoft Azure SDK for HybridCloud Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Hybrid cloud connectivity Management API. Package tag package-2023-01-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 + 0 + 0 + + + + com.azure + azure-core + 1.38.0 + + + com.azure + azure-core-management + 1.11.0 + + + diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/HybridCloudManager.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/HybridCloudManager.java new file mode 100644 index 000000000000..549e9e9e8a2a --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/HybridCloudManager.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridcloud.fluent.HybridCloudClient; +import com.azure.resourcemanager.hybridcloud.implementation.CloudConnectionsImpl; +import com.azure.resourcemanager.hybridcloud.implementation.CloudConnectorsImpl; +import com.azure.resourcemanager.hybridcloud.implementation.HybridCloudClientBuilder; +import com.azure.resourcemanager.hybridcloud.implementation.HybridCloudsImpl; +import com.azure.resourcemanager.hybridcloud.models.CloudConnections; +import com.azure.resourcemanager.hybridcloud.models.CloudConnectors; +import com.azure.resourcemanager.hybridcloud.models.HybridClouds; +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 HybridCloudManager. Hybrid cloud connectivity Management API. */ +public final class HybridCloudManager { + private HybridClouds hybridClouds; + + private CloudConnectors cloudConnectors; + + private CloudConnections cloudConnections; + + private final HybridCloudClient clientObject; + + private HybridCloudManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new HybridCloudClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of HybridCloud service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the HybridCloud service API instance. + */ + public static HybridCloudManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of HybridCloud service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the HybridCloud service API instance. + */ + public static HybridCloudManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new HybridCloudManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create HybridCloudManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new HybridCloudManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of HybridCloud service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the HybridCloud service API instance. + */ + public HybridCloudManager 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.hybridcloud") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new HybridCloudManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of HybridClouds. + * + * @return Resource collection API of HybridClouds. + */ + public HybridClouds hybridClouds() { + if (this.hybridClouds == null) { + this.hybridClouds = new HybridCloudsImpl(clientObject.getHybridClouds(), this); + } + return hybridClouds; + } + + /** + * Gets the resource collection API of CloudConnectors. It manages CloudConnector. + * + * @return Resource collection API of CloudConnectors. + */ + public CloudConnectors cloudConnectors() { + if (this.cloudConnectors == null) { + this.cloudConnectors = new CloudConnectorsImpl(clientObject.getCloudConnectors(), this); + } + return cloudConnectors; + } + + /** + * Gets the resource collection API of CloudConnections. It manages CloudConnection. + * + * @return Resource collection API of CloudConnections. + */ + public CloudConnections cloudConnections() { + if (this.cloudConnections == null) { + this.cloudConnections = new CloudConnectionsImpl(clientObject.getCloudConnections(), this); + } + return cloudConnections; + } + + /** + * @return Wrapped service client HybridCloudClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public HybridCloudClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/CloudConnectionsClient.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/CloudConnectionsClient.java new file mode 100644 index 000000000000..b2067c463a48 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/CloudConnectionsClient.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.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.hybridcloud.fluent.models.CloudConnectionInner; +import com.azure.resourcemanager.hybridcloud.models.TagsObject; + +/** An instance of this class provides access to all the operations defined in CloudConnectionsClient. */ +public interface CloudConnectionsClient { + /** + * Return list of cloud connections in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Return list of cloud connections in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Return list of cloud connections in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Return list of cloud connections in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the specified cloud connection in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection 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 specified cloud connection in a specified resource group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String cloudConnectionName, Context context); + + /** + * Gets the specified cloud connection in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified cloud connection in a specified resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudConnectionInner getByResourceGroup(String resourceGroupName, String cloudConnectionName); + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource which represents the managed network connection between + * Azure Gateways and remote cloud gateways. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudConnectionInner> beginCreateOrUpdate( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters); + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource which represents the managed network connection between + * Azure Gateways and remote cloud gateways. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudConnectionInner> beginCreateOrUpdate( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters, Context context); + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource which represents the managed network connection between Azure Gateways and remote cloud + * gateways. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudConnectionInner createOrUpdate( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters); + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @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 resource which represents the managed network connection between Azure Gateways and remote cloud + * gateways. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudConnectionInner createOrUpdate( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters, Context context); + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cloudConnectionName); + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String cloudConnectionName, Context context); + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cloudConnectionName); + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cloudConnectionName, Context context); + + /** + * Updates the specified cloud connection tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters Parameters supplied to update cloud connection tags. + * @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 resource which represents the managed network connection between Azure Gateways and remote cloud gateways + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateTagsWithResponse( + String resourceGroupName, String cloudConnectionName, TagsObject parameters, Context context); + + /** + * Updates the specified cloud connection tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters Parameters supplied to update cloud connection tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource which represents the managed network connection between Azure Gateways and remote cloud + * gateways. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudConnectionInner updateTags(String resourceGroupName, String cloudConnectionName, TagsObject parameters); +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/CloudConnectorsClient.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/CloudConnectorsClient.java new file mode 100644 index 000000000000..50defc8d0e22 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/CloudConnectorsClient.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.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.hybridcloud.fluent.models.CloudConnectorInner; +import com.azure.resourcemanager.hybridcloud.fluent.models.DiscoveredResourcesInner; +import com.azure.resourcemanager.hybridcloud.models.TagsObject; + +/** An instance of this class provides access to all the operations defined in CloudConnectorsClient. */ +public interface CloudConnectorsClient { + /** + * Return list of cloud connectors in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Return list of cloud connectors in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Return list of cloud connectors in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Return list of cloud connectors in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the specified cloud connector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 specified cloud connector in a specified resource group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String cloudConnectorName, Context context); + + /** + * Gets the specified cloud connector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified cloud connector in a specified resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudConnectorInner getByResourceGroup(String resourceGroupName, String cloudConnectorName); + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of cloud Connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudConnectorInner> beginCreateOrUpdate( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters); + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of cloud Connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudConnectorInner> beginCreateOrUpdate( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters, Context context); + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cloud Connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudConnectorInner createOrUpdate( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters); + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector 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 cloud Connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudConnectorInner createOrUpdate( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters, Context context); + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cloudConnectorName); + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String cloudConnectorName, Context context); + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cloudConnectorName); + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cloudConnectorName, Context context); + + /** + * Updates the specified cloud connector tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters Parameters supplied to update cloud connector tags. + * @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 cloud Connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateTagsWithResponse( + String resourceGroupName, String cloudConnectorName, TagsObject parameters, Context context); + + /** + * Updates the specified cloud connector tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters Parameters supplied to update cloud connector tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cloud Connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudConnectorInner updateTags(String resourceGroupName, String cloudConnectorName, TagsObject parameters); + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of aPI to discover resources in remote cloud referred by the + * connector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoveredResourcesInner> beginDiscoverResources( + String resourceGroupName, String cloudConnectorName); + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of aPI to discover resources in remote cloud referred by the + * connector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoveredResourcesInner> beginDiscoverResources( + String resourceGroupName, String cloudConnectorName, Context context); + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI to discover resources in remote cloud referred by the connector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredResourcesInner discoverResources(String resourceGroupName, String cloudConnectorName); + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 aPI to discover resources in remote cloud referred by the connector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredResourcesInner discoverResources(String resourceGroupName, String cloudConnectorName, Context context); +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/HybridCloudClient.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/HybridCloudClient.java new file mode 100644 index 000000000000..857c991e24bb --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/HybridCloudClient.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.hybridcloud.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for HybridCloudClient class. */ +public interface HybridCloudClient { + /** + * 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 HybridCloudsClient object to access its operations. + * + * @return the HybridCloudsClient object. + */ + HybridCloudsClient getHybridClouds(); + + /** + * Gets the CloudConnectorsClient object to access its operations. + * + * @return the CloudConnectorsClient object. + */ + CloudConnectorsClient getCloudConnectors(); + + /** + * Gets the CloudConnectionsClient object to access its operations. + * + * @return the CloudConnectionsClient object. + */ + CloudConnectionsClient getCloudConnections(); +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/HybridCloudsClient.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/HybridCloudsClient.java new file mode 100644 index 000000000000..5485af803d22 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/HybridCloudsClient.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.hybridcloud.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridcloud.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in HybridCloudsClient. */ +public interface HybridCloudsClient { + /** + * Lists all of the available HybridCloud Rest API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOperations(); + + /** + * Lists all of the available HybridCloud Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOperations(Context context); +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectionInner.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectionInner.java new file mode 100644 index 000000000000..449362ab1797 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectionInner.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.hybridcloud.models.ProvisioningState; +import com.azure.resourcemanager.hybridcloud.models.ResourceReference; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Resource which represents the managed network connection between Azure Gateways and remote cloud gateways. */ +@Fluent +public final class CloudConnectionInner extends Resource { + /* + * Properties of the cloud connection. + */ + @JsonProperty(value = "properties") + private CloudConnectionProperties innerProperties; + + /* + * A unique read-only string that changes whenever the resource is updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of CloudConnectionInner class. */ + public CloudConnectionInner() { + } + + /** + * Get the innerProperties property: Properties of the cloud connection. + * + * @return the innerProperties value. + */ + private CloudConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public CloudConnectionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CloudConnectionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the cloudConnector property: The cloud connector which discovered the remote resource. + * + * @return the cloudConnector value. + */ + public ResourceReference cloudConnector() { + return this.innerProperties() == null ? null : this.innerProperties().cloudConnector(); + } + + /** + * Set the cloudConnector property: The cloud connector which discovered the remote resource. + * + * @param cloudConnector the cloudConnector value to set. + * @return the CloudConnectionInner object itself. + */ + public CloudConnectionInner withCloudConnector(ResourceReference cloudConnector) { + if (this.innerProperties() == null) { + this.innerProperties = new CloudConnectionProperties(); + } + this.innerProperties().withCloudConnector(cloudConnector); + return this; + } + + /** + * Get the remoteResourceId property: Identifier for the remote cloud resource. + * + * @return the remoteResourceId value. + */ + public String remoteResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().remoteResourceId(); + } + + /** + * Set the remoteResourceId property: Identifier for the remote cloud resource. + * + * @param remoteResourceId the remoteResourceId value to set. + * @return the CloudConnectionInner object itself. + */ + public CloudConnectionInner withRemoteResourceId(String remoteResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new CloudConnectionProperties(); + } + this.innerProperties().withRemoteResourceId(remoteResourceId); + return this; + } + + /** + * Get the virtualHub property: The virtualHub to which the cloud connection belongs. + * + * @return the virtualHub value. + */ + public ResourceReference virtualHub() { + return this.innerProperties() == null ? null : this.innerProperties().virtualHub(); + } + + /** + * Set the virtualHub property: The virtualHub to which the cloud connection belongs. + * + * @param virtualHub the virtualHub value to set. + * @return the CloudConnectionInner object itself. + */ + public CloudConnectionInner withVirtualHub(ResourceReference virtualHub) { + if (this.innerProperties() == null) { + this.innerProperties = new CloudConnectionProperties(); + } + this.innerProperties().withVirtualHub(virtualHub); + return this; + } + + /** + * Get the sharedKey property: Shared key of the cloud connection. + * + * @return the sharedKey value. + */ + public String sharedKey() { + return this.innerProperties() == null ? null : this.innerProperties().sharedKey(); + } + + /** + * Set the sharedKey property: Shared key of the cloud connection. + * + * @param sharedKey the sharedKey value to set. + * @return the CloudConnectionInner object itself. + */ + public CloudConnectionInner withSharedKey(String sharedKey) { + if (this.innerProperties() == null) { + this.innerProperties = new CloudConnectionProperties(); + } + this.innerProperties().withSharedKey(sharedKey); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the cloud collection resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectionProperties.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectionProperties.java new file mode 100644 index 000000000000..8260f2ca7819 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectionProperties.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.hybridcloud.models.ProvisioningState; +import com.azure.resourcemanager.hybridcloud.models.ResourceReference; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cloud connection resource properties. */ +@Fluent +public final class CloudConnectionProperties { + /* + * The cloud connector which discovered the remote resource. + */ + @JsonProperty(value = "cloudConnector") + private ResourceReference cloudConnector; + + /* + * Identifier for the remote cloud resource + */ + @JsonProperty(value = "remoteResourceId") + private String remoteResourceId; + + /* + * The virtualHub to which the cloud connection belongs. + */ + @JsonProperty(value = "virtualHub") + private ResourceReference virtualHub; + + /* + * Shared key of the cloud connection. + */ + @JsonProperty(value = "sharedKey") + private String sharedKey; + + /* + * The provisioning state of the cloud collection resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of CloudConnectionProperties class. */ + public CloudConnectionProperties() { + } + + /** + * Get the cloudConnector property: The cloud connector which discovered the remote resource. + * + * @return the cloudConnector value. + */ + public ResourceReference cloudConnector() { + return this.cloudConnector; + } + + /** + * Set the cloudConnector property: The cloud connector which discovered the remote resource. + * + * @param cloudConnector the cloudConnector value to set. + * @return the CloudConnectionProperties object itself. + */ + public CloudConnectionProperties withCloudConnector(ResourceReference cloudConnector) { + this.cloudConnector = cloudConnector; + return this; + } + + /** + * Get the remoteResourceId property: Identifier for the remote cloud resource. + * + * @return the remoteResourceId value. + */ + public String remoteResourceId() { + return this.remoteResourceId; + } + + /** + * Set the remoteResourceId property: Identifier for the remote cloud resource. + * + * @param remoteResourceId the remoteResourceId value to set. + * @return the CloudConnectionProperties object itself. + */ + public CloudConnectionProperties withRemoteResourceId(String remoteResourceId) { + this.remoteResourceId = remoteResourceId; + return this; + } + + /** + * Get the virtualHub property: The virtualHub to which the cloud connection belongs. + * + * @return the virtualHub value. + */ + public ResourceReference virtualHub() { + return this.virtualHub; + } + + /** + * Set the virtualHub property: The virtualHub to which the cloud connection belongs. + * + * @param virtualHub the virtualHub value to set. + * @return the CloudConnectionProperties object itself. + */ + public CloudConnectionProperties withVirtualHub(ResourceReference virtualHub) { + this.virtualHub = virtualHub; + return this; + } + + /** + * Get the sharedKey property: Shared key of the cloud connection. + * + * @return the sharedKey value. + */ + public String sharedKey() { + return this.sharedKey; + } + + /** + * Set the sharedKey property: Shared key of the cloud connection. + * + * @param sharedKey the sharedKey value to set. + * @return the CloudConnectionProperties object itself. + */ + public CloudConnectionProperties withSharedKey(String sharedKey) { + this.sharedKey = sharedKey; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the cloud collection resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (cloudConnector() != null) { + cloudConnector().validate(); + } + if (virtualHub() != null) { + virtualHub().validate(); + } + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectorInner.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectorInner.java new file mode 100644 index 000000000000..2bad157d91e9 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectorInner.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.hybridcloud.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.hybridcloud.models.CloudType; +import com.azure.resourcemanager.hybridcloud.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Cloud Connector resource. */ +@Fluent +public final class CloudConnectorInner extends Resource { + /* + * Properties of the cloud connector. + */ + @JsonProperty(value = "properties") + private CloudConnectorProperties innerProperties; + + /* + * A unique read-only string that changes whenever the resource is updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of CloudConnectorInner class. */ + public CloudConnectorInner() { + } + + /** + * Get the innerProperties property: Properties of the cloud connector. + * + * @return the innerProperties value. + */ + private CloudConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public CloudConnectorInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CloudConnectorInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the accountId property: Account identifier of the remote cloud. + * + * @return the accountId value. + */ + public String accountId() { + return this.innerProperties() == null ? null : this.innerProperties().accountId(); + } + + /** + * Set the accountId property: Account identifier of the remote cloud. + * + * @param accountId the accountId value to set. + * @return the CloudConnectorInner object itself. + */ + public CloudConnectorInner withAccountId(String accountId) { + if (this.innerProperties() == null) { + this.innerProperties = new CloudConnectorProperties(); + } + this.innerProperties().withAccountId(accountId); + return this; + } + + /** + * Get the cloudType property: The cloud connector type. + * + * @return the cloudType value. + */ + public CloudType cloudType() { + return this.innerProperties() == null ? null : this.innerProperties().cloudType(); + } + + /** + * Set the cloudType property: The cloud connector type. + * + * @param cloudType the cloudType value to set. + * @return the CloudConnectorInner object itself. + */ + public CloudConnectorInner withCloudType(CloudType cloudType) { + if (this.innerProperties() == null) { + this.innerProperties = new CloudConnectorProperties(); + } + this.innerProperties().withCloudType(cloudType); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the cloud connector resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectorProperties.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectorProperties.java new file mode 100644 index 000000000000..5b719e9355a6 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/CloudConnectorProperties.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.hybridcloud.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.hybridcloud.models.CloudType; +import com.azure.resourcemanager.hybridcloud.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cloud connector resource properties. */ +@Fluent +public final class CloudConnectorProperties { + /* + * Account identifier of the remote cloud. + */ + @JsonProperty(value = "accountId") + private String accountId; + + /* + * The cloud connector type. + */ + @JsonProperty(value = "cloudType") + private CloudType cloudType; + + /* + * The provisioning state of the cloud connector resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of CloudConnectorProperties class. */ + public CloudConnectorProperties() { + } + + /** + * Get the accountId property: Account identifier of the remote cloud. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Set the accountId property: Account identifier of the remote cloud. + * + * @param accountId the accountId value to set. + * @return the CloudConnectorProperties object itself. + */ + public CloudConnectorProperties withAccountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Get the cloudType property: The cloud connector type. + * + * @return the cloudType value. + */ + public CloudType cloudType() { + return this.cloudType; + } + + /** + * Set the cloudType property: The cloud connector type. + * + * @param cloudType the cloudType value to set. + * @return the CloudConnectorProperties object itself. + */ + public CloudConnectorProperties withCloudType(CloudType cloudType) { + this.cloudType = cloudType; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the cloud connector resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/DiscoveredResourcesInner.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/DiscoveredResourcesInner.java new file mode 100644 index 000000000000..8cc6959a6d95 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/DiscoveredResourcesInner.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.hybridcloud.models.DiscoveredResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** API to discover resources in remote cloud referred by the connector. */ +@Fluent +public final class DiscoveredResourcesInner { + /* + * Remote cloud resource filter. + */ + @JsonProperty(value = "resourceFilter") + private ResourceFilter innerResourceFilter; + + /* + * List of discovered remote cloud resources. + */ + @JsonProperty(value = "discoveredResources") + private List discoveredResources; + + /** Creates an instance of DiscoveredResourcesInner class. */ + public DiscoveredResourcesInner() { + } + + /** + * Get the innerResourceFilter property: Remote cloud resource filter. + * + * @return the innerResourceFilter value. + */ + private ResourceFilter innerResourceFilter() { + return this.innerResourceFilter; + } + + /** + * Get the discoveredResources property: List of discovered remote cloud resources. + * + * @return the discoveredResources value. + */ + public List discoveredResources() { + return this.discoveredResources; + } + + /** + * Set the discoveredResources property: List of discovered remote cloud resources. + * + * @param discoveredResources the discoveredResources value to set. + * @return the DiscoveredResourcesInner object itself. + */ + public DiscoveredResourcesInner withDiscoveredResources(List discoveredResources) { + this.discoveredResources = discoveredResources; + return this; + } + + /** + * Get the name property: Remote Resource name to filter on. + * + * @return the name value. + */ + public String name() { + return this.innerResourceFilter() == null ? null : this.innerResourceFilter().name(); + } + + /** + * Set the name property: Remote Resource name to filter on. + * + * @param name the name value to set. + * @return the DiscoveredResourcesInner object itself. + */ + public DiscoveredResourcesInner withName(String name) { + if (this.innerResourceFilter() == null) { + this.innerResourceFilter = new ResourceFilter(); + } + this.innerResourceFilter().withName(name); + return this; + } + + /** + * Get the type property: Remote Resource type to filter on. + * + * @return the type value. + */ + public String type() { + return this.innerResourceFilter() == null ? null : this.innerResourceFilter().type(); + } + + /** + * Set the type property: Remote Resource type to filter on. + * + * @param type the type value to set. + * @return the DiscoveredResourcesInner object itself. + */ + public DiscoveredResourcesInner withType(String type) { + if (this.innerResourceFilter() == null) { + this.innerResourceFilter = new ResourceFilter(); + } + this.innerResourceFilter().withType(type); + return this; + } + + /** + * Get the region property: Remote Resource location/region to filter on. + * + * @return the region value. + */ + public String region() { + return this.innerResourceFilter() == null ? null : this.innerResourceFilter().region(); + } + + /** + * Set the region property: Remote Resource location/region to filter on. + * + * @param region the region value to set. + * @return the DiscoveredResourcesInner object itself. + */ + public DiscoveredResourcesInner withRegion(String region) { + if (this.innerResourceFilter() == null) { + this.innerResourceFilter = new ResourceFilter(); + } + this.innerResourceFilter().withRegion(region); + return this; + } + + /** + * Get the tag property: Remote Resource tags to filter on in key:value format. + * + * @return the tag value. + */ + public String tag() { + return this.innerResourceFilter() == null ? null : this.innerResourceFilter().tag(); + } + + /** + * Set the tag property: Remote Resource tags to filter on in key:value format. + * + * @param tag the tag value to set. + * @return the DiscoveredResourcesInner object itself. + */ + public DiscoveredResourcesInner withTag(String tag) { + if (this.innerResourceFilter() == null) { + this.innerResourceFilter = new ResourceFilter(); + } + this.innerResourceFilter().withTag(tag); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerResourceFilter() != null) { + innerResourceFilter().validate(); + } + if (discoveredResources() != null) { + discoveredResources().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/OperationInner.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/OperationInner.java new file mode 100644 index 000000000000..afbf086b1f35 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/OperationInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.hybridcloud.models.ActionType; +import com.azure.resourcemanager.hybridcloud.models.OperationDisplay; +import com.azure.resourcemanager.hybridcloud.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + *

Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/ResourceFilter.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/ResourceFilter.java new file mode 100644 index 000000000000..0ba5a221bf4c --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/ResourceFilter.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Remote Cloud Resource filter. */ +@Fluent +public final class ResourceFilter { + /* + * Remote Resource name to filter on. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Remote Resource type to filter on. + */ + @JsonProperty(value = "type") + private String type; + + /* + * Remote Resource location/region to filter on. + */ + @JsonProperty(value = "region") + private String region; + + /* + * Remote Resource tags to filter on in key:value format. + */ + @JsonProperty(value = "tag") + private String tag; + + /** Creates an instance of ResourceFilter class. */ + public ResourceFilter() { + } + + /** + * Get the name property: Remote Resource name to filter on. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Remote Resource name to filter on. + * + * @param name the name value to set. + * @return the ResourceFilter object itself. + */ + public ResourceFilter withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Remote Resource type to filter on. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Remote Resource type to filter on. + * + * @param type the type value to set. + * @return the ResourceFilter object itself. + */ + public ResourceFilter withType(String type) { + this.type = type; + return this; + } + + /** + * Get the region property: Remote Resource location/region to filter on. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Set the region property: Remote Resource location/region to filter on. + * + * @param region the region value to set. + * @return the ResourceFilter object itself. + */ + public ResourceFilter withRegion(String region) { + this.region = region; + return this; + } + + /** + * Get the tag property: Remote Resource tags to filter on in key:value format. + * + * @return the tag value. + */ + public String tag() { + return this.tag; + } + + /** + * Set the tag property: Remote Resource tags to filter on in key:value format. + * + * @param tag the tag value to set. + * @return the ResourceFilter object itself. + */ + public ResourceFilter withTag(String tag) { + this.tag = tag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/package-info.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/package-info.java new file mode 100644 index 000000000000..938d18c88d4b --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for HybridCloudClient. Hybrid cloud connectivity Management API. */ +package com.azure.resourcemanager.hybridcloud.fluent.models; diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/package-info.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/package-info.java new file mode 100644 index 000000000000..53a37fe0649e --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for HybridCloudClient. Hybrid cloud connectivity Management API. */ +package com.azure.resourcemanager.hybridcloud.fluent; diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectionImpl.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectionImpl.java new file mode 100644 index 000000000000..c481e3ec413d --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectionImpl.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridcloud.fluent.models.CloudConnectionInner; +import com.azure.resourcemanager.hybridcloud.models.CloudConnection; +import com.azure.resourcemanager.hybridcloud.models.ProvisioningState; +import com.azure.resourcemanager.hybridcloud.models.ResourceReference; +import com.azure.resourcemanager.hybridcloud.models.TagsObject; +import java.util.Collections; +import java.util.Map; + +public final class CloudConnectionImpl implements CloudConnection, CloudConnection.Definition, CloudConnection.Update { + private CloudConnectionInner innerObject; + + private final com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ResourceReference cloudConnector() { + return this.innerModel().cloudConnector(); + } + + public String remoteResourceId() { + return this.innerModel().remoteResourceId(); + } + + public ResourceReference virtualHub() { + return this.innerModel().virtualHub(); + } + + public String sharedKey() { + return this.innerModel().sharedKey(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public CloudConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.hybridcloud.HybridCloudManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String cloudConnectionName; + + private TagsObject updateParameters; + + public CloudConnectionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CloudConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getCloudConnections() + .createOrUpdate(resourceGroupName, cloudConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public CloudConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCloudConnections() + .createOrUpdate(resourceGroupName, cloudConnectionName, this.innerModel(), context); + return this; + } + + CloudConnectionImpl(String name, com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager) { + this.innerObject = new CloudConnectionInner(); + this.serviceManager = serviceManager; + this.cloudConnectionName = name; + } + + public CloudConnectionImpl update() { + this.updateParameters = new TagsObject(); + return this; + } + + public CloudConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCloudConnections() + .updateTagsWithResponse(resourceGroupName, cloudConnectionName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public CloudConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCloudConnections() + .updateTagsWithResponse(resourceGroupName, cloudConnectionName, updateParameters, context) + .getValue(); + return this; + } + + CloudConnectionImpl( + CloudConnectionInner innerObject, com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.cloudConnectionName = Utils.getValueFromIdByName(innerObject.id(), "cloudConnections"); + } + + public CloudConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCloudConnections() + .getByResourceGroupWithResponse(resourceGroupName, cloudConnectionName, Context.NONE) + .getValue(); + return this; + } + + public CloudConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCloudConnections() + .getByResourceGroupWithResponse(resourceGroupName, cloudConnectionName, context) + .getValue(); + return this; + } + + public CloudConnectionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CloudConnectionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CloudConnectionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public CloudConnectionImpl withCloudConnector(ResourceReference cloudConnector) { + this.innerModel().withCloudConnector(cloudConnector); + return this; + } + + public CloudConnectionImpl withRemoteResourceId(String remoteResourceId) { + this.innerModel().withRemoteResourceId(remoteResourceId); + return this; + } + + public CloudConnectionImpl withVirtualHub(ResourceReference virtualHub) { + this.innerModel().withVirtualHub(virtualHub); + return this; + } + + public CloudConnectionImpl withSharedKey(String sharedKey) { + this.innerModel().withSharedKey(sharedKey); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectionsClientImpl.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectionsClientImpl.java new file mode 100644 index 000000000000..107dc1d68971 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectionsClientImpl.java @@ -0,0 +1,1461 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.hybridcloud.fluent.CloudConnectionsClient; +import com.azure.resourcemanager.hybridcloud.fluent.models.CloudConnectionInner; +import com.azure.resourcemanager.hybridcloud.models.CloudConnectionListResult; +import com.azure.resourcemanager.hybridcloud.models.TagsObject; +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 CloudConnectionsClient. */ +public final class CloudConnectionsClientImpl implements CloudConnectionsClient { + /** The proxy service used to perform REST calls. */ + private final CloudConnectionsService service; + + /** The service client containing this operation class. */ + private final HybridCloudClientImpl client; + + /** + * Initializes an instance of CloudConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudConnectionsClientImpl(HybridCloudClientImpl client) { + this.service = + RestProxy.create(CloudConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HybridCloudClientCloudConnections to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HybridCloudClientClo") + public interface CloudConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.HybridCloud/cloudConnections") + @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.HybridCloud/cloudConnections") + @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}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCloud/cloudConnections/{cloudConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudConnectionName") String cloudConnectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCloud/cloudConnections/{cloudConnectionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudConnectionName") String cloudConnectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CloudConnectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCloud/cloudConnections/{cloudConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudConnectionName") String cloudConnectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCloud/cloudConnections/{cloudConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateTags( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudConnectionName") String cloudConnectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TagsObject parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Return list of cloud connections in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.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())); + } + + /** + * Return list of cloud connections in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Return list of cloud connections in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Return list of cloud connections in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Return list of cloud connections in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Return list of cloud connections in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Return list of cloud connections in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.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())); + } + + /** + * Return list of cloud connections in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Return list of cloud connections in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Return list of cloud connections in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Return list of cloud connections in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Return list of cloud connections in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the specified cloud connection in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection 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 specified cloud connection in a specified resource group along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String cloudConnectionName) { + 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 (cloudConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified cloud connection in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection 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 specified cloud connection in a specified resource group along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String cloudConnectionName, 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 (cloudConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectionName 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, + cloudConnectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the specified cloud connection in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection 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 specified cloud connection in a specified resource group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String cloudConnectionName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, cloudConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified cloud connection in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection 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 specified cloud connection in a specified resource group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String cloudConnectionName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, cloudConnectionName, context).block(); + } + + /** + * Gets the specified cloud connection in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection 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 specified cloud connection in a specified resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudConnectionInner getByResourceGroup(String resourceGroupName, String cloudConnectionName) { + return getByResourceGroupWithResponse(resourceGroupName, cloudConnectionName, Context.NONE).getValue(); + } + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource which represents the managed network connection between Azure Gateways and remote cloud gateways + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters) { + 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 (cloudConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectionName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @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 resource which represents the managed network connection between Azure Gateways and remote cloud gateways + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters, 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 (cloudConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectionName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource which represents the managed network connection between + * Azure Gateways and remote cloud gateways. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudConnectionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, cloudConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CloudConnectionInner.class, + CloudConnectionInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource which represents the managed network connection between + * Azure Gateways and remote cloud gateways. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudConnectionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, cloudConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CloudConnectionInner.class, CloudConnectionInner.class, context); + } + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource which represents the managed network connection between + * Azure Gateways and remote cloud gateways. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudConnectionInner> beginCreateOrUpdate( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters) { + return this.beginCreateOrUpdateAsync(resourceGroupName, cloudConnectionName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource which represents the managed network connection between + * Azure Gateways and remote cloud gateways. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudConnectionInner> beginCreateOrUpdate( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, cloudConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource which represents the managed network connection between Azure Gateways and remote cloud gateways + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @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 resource which represents the managed network connection between Azure Gateways and remote cloud gateways + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource which represents the managed network connection between Azure Gateways and remote cloud + * gateways. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudConnectionInner createOrUpdate( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, cloudConnectionName, parameters).block(); + } + + /** + * Creates or updates a cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters The parameters to provide for the created cloud connection. + * @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 resource which represents the managed network connection between Azure Gateways and remote cloud + * gateways. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudConnectionInner createOrUpdate( + String resourceGroupName, String cloudConnectionName, CloudConnectionInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, cloudConnectionName, parameters, context).block(); + } + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String cloudConnectionName) { + 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 (cloudConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String cloudConnectionName, 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 (cloudConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String cloudConnectionName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, cloudConnectionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String cloudConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, cloudConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String cloudConnectionName) { + return this.beginDeleteAsync(resourceGroupName, cloudConnectionName).getSyncPoller(); + } + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String cloudConnectionName, Context context) { + return this.beginDeleteAsync(resourceGroupName, cloudConnectionName, context).getSyncPoller(); + } + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String cloudConnectionName) { + return beginDeleteAsync(resourceGroupName, cloudConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String cloudConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, cloudConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cloudConnectionName) { + deleteAsync(resourceGroupName, cloudConnectionName).block(); + } + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cloudConnectionName, Context context) { + deleteAsync(resourceGroupName, cloudConnectionName, context).block(); + } + + /** + * Updates the specified cloud connection tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters Parameters supplied to update cloud connection tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource which represents the managed network connection between Azure Gateways and remote cloud gateways + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateTagsWithResponseAsync( + String resourceGroupName, String cloudConnectionName, TagsObject parameters) { + 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 (cloudConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateTags( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectionName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the specified cloud connection tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters Parameters supplied to update cloud connection tags. + * @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 resource which represents the managed network connection between Azure Gateways and remote cloud gateways + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateTagsWithResponseAsync( + String resourceGroupName, String cloudConnectionName, TagsObject parameters, 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 (cloudConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateTags( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectionName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Updates the specified cloud connection tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters Parameters supplied to update cloud connection tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource which represents the managed network connection between Azure Gateways and remote cloud gateways + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTagsAsync( + String resourceGroupName, String cloudConnectionName, TagsObject parameters) { + return updateTagsWithResponseAsync(resourceGroupName, cloudConnectionName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates the specified cloud connection tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters Parameters supplied to update cloud connection tags. + * @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 resource which represents the managed network connection between Azure Gateways and remote cloud gateways + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateTagsWithResponse( + String resourceGroupName, String cloudConnectionName, TagsObject parameters, Context context) { + return updateTagsWithResponseAsync(resourceGroupName, cloudConnectionName, parameters, context).block(); + } + + /** + * Updates the specified cloud connection tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param parameters Parameters supplied to update cloud connection tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource which represents the managed network connection between Azure Gateways and remote cloud + * gateways. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudConnectionInner updateTags( + String resourceGroupName, String cloudConnectionName, TagsObject parameters) { + return updateTagsWithResponse(resourceGroupName, cloudConnectionName, parameters, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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

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

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

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectionsImpl.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectionsImpl.java new file mode 100644 index 000000000000..5c6e34a5ea3d --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectionsImpl.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.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.hybridcloud.fluent.CloudConnectionsClient; +import com.azure.resourcemanager.hybridcloud.fluent.models.CloudConnectionInner; +import com.azure.resourcemanager.hybridcloud.models.CloudConnection; +import com.azure.resourcemanager.hybridcloud.models.CloudConnections; + +public final class CloudConnectionsImpl implements CloudConnections { + private static final ClientLogger LOGGER = new ClientLogger(CloudConnectionsImpl.class); + + private final CloudConnectionsClient innerClient; + + private final com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager; + + public CloudConnectionsImpl( + CloudConnectionsClient innerClient, com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new CloudConnectionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new CloudConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new CloudConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new CloudConnectionImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String cloudConnectionName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, cloudConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CloudConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CloudConnection getByResourceGroup(String resourceGroupName, String cloudConnectionName) { + CloudConnectionInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, cloudConnectionName); + if (inner != null) { + return new CloudConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String cloudConnectionName) { + this.serviceClient().delete(resourceGroupName, cloudConnectionName); + } + + public void delete(String resourceGroupName, String cloudConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, cloudConnectionName, context); + } + + public CloudConnection 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 cloudConnectionName = Utils.getValueFromIdByName(id, "cloudConnections"); + if (cloudConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cloudConnections'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cloudConnectionName, 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 cloudConnectionName = Utils.getValueFromIdByName(id, "cloudConnections"); + if (cloudConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cloudConnections'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cloudConnectionName, 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 cloudConnectionName = Utils.getValueFromIdByName(id, "cloudConnections"); + if (cloudConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cloudConnections'.", id))); + } + this.delete(resourceGroupName, cloudConnectionName, 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 cloudConnectionName = Utils.getValueFromIdByName(id, "cloudConnections"); + if (cloudConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cloudConnections'.", id))); + } + this.delete(resourceGroupName, cloudConnectionName, context); + } + + private CloudConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.hybridcloud.HybridCloudManager manager() { + return this.serviceManager; + } + + public CloudConnectionImpl define(String name) { + return new CloudConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectorImpl.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectorImpl.java new file mode 100644 index 000000000000..9226304ad660 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectorImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridcloud.fluent.models.CloudConnectorInner; +import com.azure.resourcemanager.hybridcloud.models.CloudConnector; +import com.azure.resourcemanager.hybridcloud.models.CloudType; +import com.azure.resourcemanager.hybridcloud.models.DiscoveredResources; +import com.azure.resourcemanager.hybridcloud.models.ProvisioningState; +import com.azure.resourcemanager.hybridcloud.models.TagsObject; +import java.util.Collections; +import java.util.Map; + +public final class CloudConnectorImpl implements CloudConnector, CloudConnector.Definition, CloudConnector.Update { + private CloudConnectorInner innerObject; + + private final com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String accountId() { + return this.innerModel().accountId(); + } + + public CloudType cloudType() { + return this.innerModel().cloudType(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public CloudConnectorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.hybridcloud.HybridCloudManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String cloudConnectorName; + + private TagsObject updateParameters; + + public CloudConnectorImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CloudConnector create() { + this.innerObject = + serviceManager + .serviceClient() + .getCloudConnectors() + .createOrUpdate(resourceGroupName, cloudConnectorName, this.innerModel(), Context.NONE); + return this; + } + + public CloudConnector create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCloudConnectors() + .createOrUpdate(resourceGroupName, cloudConnectorName, this.innerModel(), context); + return this; + } + + CloudConnectorImpl(String name, com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager) { + this.innerObject = new CloudConnectorInner(); + this.serviceManager = serviceManager; + this.cloudConnectorName = name; + } + + public CloudConnectorImpl update() { + this.updateParameters = new TagsObject(); + return this; + } + + public CloudConnector apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCloudConnectors() + .updateTagsWithResponse(resourceGroupName, cloudConnectorName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public CloudConnector apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCloudConnectors() + .updateTagsWithResponse(resourceGroupName, cloudConnectorName, updateParameters, context) + .getValue(); + return this; + } + + CloudConnectorImpl( + CloudConnectorInner innerObject, com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.cloudConnectorName = Utils.getValueFromIdByName(innerObject.id(), "cloudConnectors"); + } + + public CloudConnector refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCloudConnectors() + .getByResourceGroupWithResponse(resourceGroupName, cloudConnectorName, Context.NONE) + .getValue(); + return this; + } + + public CloudConnector refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCloudConnectors() + .getByResourceGroupWithResponse(resourceGroupName, cloudConnectorName, context) + .getValue(); + return this; + } + + public DiscoveredResources discoverResources() { + return serviceManager.cloudConnectors().discoverResources(resourceGroupName, cloudConnectorName); + } + + public DiscoveredResources discoverResources(Context context) { + return serviceManager.cloudConnectors().discoverResources(resourceGroupName, cloudConnectorName, context); + } + + public CloudConnectorImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CloudConnectorImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CloudConnectorImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public CloudConnectorImpl withAccountId(String accountId) { + this.innerModel().withAccountId(accountId); + return this; + } + + public CloudConnectorImpl withCloudType(CloudType cloudType) { + this.innerModel().withCloudType(cloudType); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectorsClientImpl.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectorsClientImpl.java new file mode 100644 index 000000000000..a594a8f14952 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectorsClientImpl.java @@ -0,0 +1,1717 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.hybridcloud.fluent.CloudConnectorsClient; +import com.azure.resourcemanager.hybridcloud.fluent.models.CloudConnectorInner; +import com.azure.resourcemanager.hybridcloud.fluent.models.DiscoveredResourcesInner; +import com.azure.resourcemanager.hybridcloud.models.CloudConnectorListResult; +import com.azure.resourcemanager.hybridcloud.models.TagsObject; +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 CloudConnectorsClient. */ +public final class CloudConnectorsClientImpl implements CloudConnectorsClient { + /** The proxy service used to perform REST calls. */ + private final CloudConnectorsService service; + + /** The service client containing this operation class. */ + private final HybridCloudClientImpl client; + + /** + * Initializes an instance of CloudConnectorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudConnectorsClientImpl(HybridCloudClientImpl client) { + this.service = + RestProxy.create(CloudConnectorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HybridCloudClientCloudConnectors to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HybridCloudClientClo") + public interface CloudConnectorsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.HybridCloud/cloudConnectors") + @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.HybridCloud/cloudConnectors") + @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}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCloud/cloudConnectors/{cloudConnectorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudConnectorName") String cloudConnectorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCloud/cloudConnectors/{cloudConnectorName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudConnectorName") String cloudConnectorName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CloudConnectorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCloud/cloudConnectors/{cloudConnectorName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudConnectorName") String cloudConnectorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCloud/cloudConnectors/{cloudConnectorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateTags( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudConnectorName") String cloudConnectorName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TagsObject parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCloud/cloudConnectors/{cloudConnectorName}/discoverResources") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> discoverResources( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudConnectorName") String cloudConnectorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Return list of cloud connectors in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.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())); + } + + /** + * Return list of cloud connectors in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Return list of cloud connectors in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Return list of cloud connectors in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Return list of cloud connectors in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Return list of cloud connectors in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Return list of cloud connectors in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.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())); + } + + /** + * Return list of cloud connectors in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Return list of cloud connectors in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Return list of cloud connectors in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Return list of cloud connectors in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Return list of cloud connectors in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the specified cloud connector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 specified cloud connector in a specified resource group along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String cloudConnectorName) { + 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 (cloudConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectorName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified cloud connector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 specified cloud connector in a specified resource group along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String cloudConnectorName, 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 (cloudConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectorName 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, + cloudConnectorName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the specified cloud connector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 specified cloud connector in a specified resource group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String cloudConnectorName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, cloudConnectorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified cloud connector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 specified cloud connector in a specified resource group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String cloudConnectorName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, cloudConnectorName, context).block(); + } + + /** + * Gets the specified cloud connector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 specified cloud connector in a specified resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudConnectorInner getByResourceGroup(String resourceGroupName, String cloudConnectorName) { + return getByResourceGroupWithResponse(resourceGroupName, cloudConnectorName, Context.NONE).getValue(); + } + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector 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 cloud Connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters) { + 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 (cloudConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectorName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectorName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector 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 cloud Connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters, 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 (cloudConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectorName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectorName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of cloud Connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudConnectorInner> beginCreateOrUpdateAsync( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, cloudConnectorName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CloudConnectorInner.class, + CloudConnectorInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of cloud Connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudConnectorInner> beginCreateOrUpdateAsync( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, cloudConnectorName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CloudConnectorInner.class, CloudConnectorInner.class, context); + } + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of cloud Connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudConnectorInner> beginCreateOrUpdate( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters) { + return this.beginCreateOrUpdateAsync(resourceGroupName, cloudConnectorName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of cloud Connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudConnectorInner> beginCreateOrUpdate( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, cloudConnectorName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector 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 cloud Connector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudConnectorName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector 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 cloud Connector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudConnectorName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector 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 cloud Connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudConnectorInner createOrUpdate( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters) { + return createOrUpdateAsync(resourceGroupName, cloudConnectorName, parameters).block(); + } + + /** + * Creates or updates a cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters The parameters to provide for the created cloud connector 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 cloud Connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudConnectorInner createOrUpdate( + String resourceGroupName, String cloudConnectorName, CloudConnectorInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, cloudConnectorName, parameters, context).block(); + } + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String cloudConnectorName) { + 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 (cloudConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectorName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String cloudConnectorName, 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 (cloudConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectorName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String cloudConnectorName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, cloudConnectorName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String cloudConnectorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, cloudConnectorName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String cloudConnectorName) { + return this.beginDeleteAsync(resourceGroupName, cloudConnectorName).getSyncPoller(); + } + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String cloudConnectorName, Context context) { + return this.beginDeleteAsync(resourceGroupName, cloudConnectorName, context).getSyncPoller(); + } + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String cloudConnectorName) { + return beginDeleteAsync(resourceGroupName, cloudConnectorName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String cloudConnectorName, Context context) { + return beginDeleteAsync(resourceGroupName, cloudConnectorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cloudConnectorName) { + deleteAsync(resourceGroupName, cloudConnectorName).block(); + } + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cloudConnectorName, Context context) { + deleteAsync(resourceGroupName, cloudConnectorName, context).block(); + } + + /** + * Updates the specified cloud connector tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters Parameters supplied to update cloud connector tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cloud Connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateTagsWithResponseAsync( + String resourceGroupName, String cloudConnectorName, TagsObject parameters) { + 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 (cloudConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectorName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateTags( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectorName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the specified cloud connector tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters Parameters supplied to update cloud connector tags. + * @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 cloud Connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateTagsWithResponseAsync( + String resourceGroupName, String cloudConnectorName, TagsObject parameters, 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 (cloudConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectorName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateTags( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectorName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Updates the specified cloud connector tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters Parameters supplied to update cloud connector tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cloud Connector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTagsAsync( + String resourceGroupName, String cloudConnectorName, TagsObject parameters) { + return updateTagsWithResponseAsync(resourceGroupName, cloudConnectorName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates the specified cloud connector tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters Parameters supplied to update cloud connector tags. + * @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 cloud Connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateTagsWithResponse( + String resourceGroupName, String cloudConnectorName, TagsObject parameters, Context context) { + return updateTagsWithResponseAsync(resourceGroupName, cloudConnectorName, parameters, context).block(); + } + + /** + * Updates the specified cloud connector tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param parameters Parameters supplied to update cloud connector tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cloud Connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudConnectorInner updateTags(String resourceGroupName, String cloudConnectorName, TagsObject parameters) { + return updateTagsWithResponse(resourceGroupName, cloudConnectorName, parameters, Context.NONE).getValue(); + } + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 aPI to discover resources in remote cloud referred by the connector along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> discoverResourcesWithResponseAsync( + String resourceGroupName, String cloudConnectorName) { + 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 (cloudConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .discoverResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectorName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 aPI to discover resources in remote cloud referred by the connector along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> discoverResourcesWithResponseAsync( + String resourceGroupName, String cloudConnectorName, 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 (cloudConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudConnectorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .discoverResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudConnectorName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of aPI to discover resources in remote cloud referred by the + * connector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoveredResourcesInner> beginDiscoverResourcesAsync( + String resourceGroupName, String cloudConnectorName) { + Mono>> mono = + discoverResourcesWithResponseAsync(resourceGroupName, cloudConnectorName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DiscoveredResourcesInner.class, + DiscoveredResourcesInner.class, + this.client.getContext()); + } + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of aPI to discover resources in remote cloud referred by the + * connector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoveredResourcesInner> beginDiscoverResourcesAsync( + String resourceGroupName, String cloudConnectorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + discoverResourcesWithResponseAsync(resourceGroupName, cloudConnectorName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DiscoveredResourcesInner.class, + DiscoveredResourcesInner.class, + context); + } + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of aPI to discover resources in remote cloud referred by the + * connector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoveredResourcesInner> beginDiscoverResources( + String resourceGroupName, String cloudConnectorName) { + return this.beginDiscoverResourcesAsync(resourceGroupName, cloudConnectorName).getSyncPoller(); + } + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of aPI to discover resources in remote cloud referred by the + * connector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoveredResourcesInner> beginDiscoverResources( + String resourceGroupName, String cloudConnectorName, Context context) { + return this.beginDiscoverResourcesAsync(resourceGroupName, cloudConnectorName, context).getSyncPoller(); + } + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 aPI to discover resources in remote cloud referred by the connector on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono discoverResourcesAsync(String resourceGroupName, String cloudConnectorName) { + return beginDiscoverResourcesAsync(resourceGroupName, cloudConnectorName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 aPI to discover resources in remote cloud referred by the connector on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono discoverResourcesAsync( + String resourceGroupName, String cloudConnectorName, Context context) { + return beginDiscoverResourcesAsync(resourceGroupName, cloudConnectorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 aPI to discover resources in remote cloud referred by the connector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredResourcesInner discoverResources(String resourceGroupName, String cloudConnectorName) { + return discoverResourcesAsync(resourceGroupName, cloudConnectorName).block(); + } + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 aPI to discover resources in remote cloud referred by the connector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredResourcesInner discoverResources( + String resourceGroupName, String cloudConnectorName, Context context) { + return discoverResourcesAsync(resourceGroupName, cloudConnectorName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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

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

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

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectorsImpl.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectorsImpl.java new file mode 100644 index 000000000000..2dabecfce591 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/CloudConnectorsImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.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.hybridcloud.fluent.CloudConnectorsClient; +import com.azure.resourcemanager.hybridcloud.fluent.models.CloudConnectorInner; +import com.azure.resourcemanager.hybridcloud.fluent.models.DiscoveredResourcesInner; +import com.azure.resourcemanager.hybridcloud.models.CloudConnector; +import com.azure.resourcemanager.hybridcloud.models.CloudConnectors; +import com.azure.resourcemanager.hybridcloud.models.DiscoveredResources; + +public final class CloudConnectorsImpl implements CloudConnectors { + private static final ClientLogger LOGGER = new ClientLogger(CloudConnectorsImpl.class); + + private final CloudConnectorsClient innerClient; + + private final com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager; + + public CloudConnectorsImpl( + CloudConnectorsClient innerClient, com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new CloudConnectorImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new CloudConnectorImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new CloudConnectorImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new CloudConnectorImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String cloudConnectorName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, cloudConnectorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CloudConnectorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CloudConnector getByResourceGroup(String resourceGroupName, String cloudConnectorName) { + CloudConnectorInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, cloudConnectorName); + if (inner != null) { + return new CloudConnectorImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String cloudConnectorName) { + this.serviceClient().delete(resourceGroupName, cloudConnectorName); + } + + public void delete(String resourceGroupName, String cloudConnectorName, Context context) { + this.serviceClient().delete(resourceGroupName, cloudConnectorName, context); + } + + public DiscoveredResources discoverResources(String resourceGroupName, String cloudConnectorName) { + DiscoveredResourcesInner inner = this.serviceClient().discoverResources(resourceGroupName, cloudConnectorName); + if (inner != null) { + return new DiscoveredResourcesImpl(inner, this.manager()); + } else { + return null; + } + } + + public DiscoveredResources discoverResources(String resourceGroupName, String cloudConnectorName, Context context) { + DiscoveredResourcesInner inner = + this.serviceClient().discoverResources(resourceGroupName, cloudConnectorName, context); + if (inner != null) { + return new DiscoveredResourcesImpl(inner, this.manager()); + } else { + return null; + } + } + + public CloudConnector 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 cloudConnectorName = Utils.getValueFromIdByName(id, "cloudConnectors"); + if (cloudConnectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'cloudConnectors'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cloudConnectorName, 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 cloudConnectorName = Utils.getValueFromIdByName(id, "cloudConnectors"); + if (cloudConnectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'cloudConnectors'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cloudConnectorName, 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 cloudConnectorName = Utils.getValueFromIdByName(id, "cloudConnectors"); + if (cloudConnectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'cloudConnectors'.", id))); + } + this.delete(resourceGroupName, cloudConnectorName, 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 cloudConnectorName = Utils.getValueFromIdByName(id, "cloudConnectors"); + if (cloudConnectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'cloudConnectors'.", id))); + } + this.delete(resourceGroupName, cloudConnectorName, context); + } + + private CloudConnectorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.hybridcloud.HybridCloudManager manager() { + return this.serviceManager; + } + + public CloudConnectorImpl define(String name) { + return new CloudConnectorImpl(name, this.manager()); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/DiscoveredResourcesImpl.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/DiscoveredResourcesImpl.java new file mode 100644 index 000000000000..33ff6cdc525a --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/DiscoveredResourcesImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.implementation; + +import com.azure.resourcemanager.hybridcloud.fluent.models.DiscoveredResourcesInner; +import com.azure.resourcemanager.hybridcloud.models.DiscoveredResource; +import com.azure.resourcemanager.hybridcloud.models.DiscoveredResources; +import java.util.Collections; +import java.util.List; + +public final class DiscoveredResourcesImpl implements DiscoveredResources { + private DiscoveredResourcesInner innerObject; + + private final com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager; + + DiscoveredResourcesImpl( + DiscoveredResourcesInner innerObject, com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List discoveredResources() { + List inner = this.innerModel().discoveredResources(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String region() { + return this.innerModel().region(); + } + + public String tag() { + return this.innerModel().tag(); + } + + public DiscoveredResourcesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.hybridcloud.HybridCloudManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudClientBuilder.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudClientBuilder.java new file mode 100644 index 000000000000..03e0e1443184 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudClientBuilder.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the HybridCloudClientImpl type. */ +@ServiceClientBuilder(serviceClients = {HybridCloudClientImpl.class}) +public final class HybridCloudClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the HybridCloudClientBuilder. + */ + public HybridCloudClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the HybridCloudClientBuilder. + */ + public HybridCloudClientBuilder 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 HybridCloudClientBuilder. + */ + public HybridCloudClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the HybridCloudClientBuilder. + */ + public HybridCloudClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the HybridCloudClientBuilder. + */ + public HybridCloudClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the HybridCloudClientBuilder. + */ + public HybridCloudClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of HybridCloudClientImpl with the provided parameters. + * + * @return an instance of HybridCloudClientImpl. + */ + public HybridCloudClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + HybridCloudClientImpl client = + new HybridCloudClientImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudClientImpl.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudClientImpl.java new file mode 100644 index 000000000000..d8faa40e4064 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudClientImpl.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.hybridcloud.fluent.CloudConnectionsClient; +import com.azure.resourcemanager.hybridcloud.fluent.CloudConnectorsClient; +import com.azure.resourcemanager.hybridcloud.fluent.HybridCloudClient; +import com.azure.resourcemanager.hybridcloud.fluent.HybridCloudsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the HybridCloudClientImpl type. */ +@ServiceClient(builder = HybridCloudClientBuilder.class) +public final class HybridCloudClientImpl implements HybridCloudClient { + /** 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 HybridCloudsClient object to access its operations. */ + private final HybridCloudsClient hybridClouds; + + /** + * Gets the HybridCloudsClient object to access its operations. + * + * @return the HybridCloudsClient object. + */ + public HybridCloudsClient getHybridClouds() { + return this.hybridClouds; + } + + /** The CloudConnectorsClient object to access its operations. */ + private final CloudConnectorsClient cloudConnectors; + + /** + * Gets the CloudConnectorsClient object to access its operations. + * + * @return the CloudConnectorsClient object. + */ + public CloudConnectorsClient getCloudConnectors() { + return this.cloudConnectors; + } + + /** The CloudConnectionsClient object to access its operations. */ + private final CloudConnectionsClient cloudConnections; + + /** + * Gets the CloudConnectionsClient object to access its operations. + * + * @return the CloudConnectionsClient object. + */ + public CloudConnectionsClient getCloudConnections() { + return this.cloudConnections; + } + + /** + * Initializes an instance of HybridCloudClient 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. + */ + HybridCloudClientImpl( + 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 = "2023-01-01-preview"; + this.hybridClouds = new HybridCloudsClientImpl(this); + this.cloudConnectors = new CloudConnectorsClientImpl(this); + this.cloudConnections = new CloudConnectionsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HybridCloudClientImpl.class); +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudsClientImpl.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudsClientImpl.java new file mode 100644 index 000000000000..1ca3d9eae789 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudsClientImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.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.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.hybridcloud.fluent.HybridCloudsClient; +import com.azure.resourcemanager.hybridcloud.fluent.models.OperationInner; +import com.azure.resourcemanager.hybridcloud.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in HybridCloudsClient. */ +public final class HybridCloudsClientImpl implements HybridCloudsClient { + /** The proxy service used to perform REST calls. */ + private final HybridCloudsService service; + + /** The service client containing this operation class. */ + private final HybridCloudClientImpl client; + + /** + * Initializes an instance of HybridCloudsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HybridCloudsClientImpl(HybridCloudClientImpl client) { + this.service = + RestProxy.create(HybridCloudsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HybridCloudClientHybridClouds to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HybridCloudClientHyb") + public interface HybridCloudsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.HybridCloud/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listOperations( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available HybridCloud Rest API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsSinglePageAsync() { + 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.listOperations(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available HybridCloud Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsSinglePageAsync(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 + .listOperations(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists all of the available HybridCloud Rest API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOperationsAsync() { + return new PagedFlux<>(() -> listOperationsSinglePageAsync()); + } + + /** + * Lists all of the available HybridCloud Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOperationsAsync(Context context) { + return new PagedFlux<>(() -> listOperationsSinglePageAsync(context)); + } + + /** + * Lists all of the available HybridCloud Rest API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperations() { + return new PagedIterable<>(listOperationsAsync()); + } + + /** + * Lists all of the available HybridCloud Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperations(Context context) { + return new PagedIterable<>(listOperationsAsync(context)); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudsImpl.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudsImpl.java new file mode 100644 index 000000000000..8686916085c0 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/HybridCloudsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridcloud.fluent.HybridCloudsClient; +import com.azure.resourcemanager.hybridcloud.fluent.models.OperationInner; +import com.azure.resourcemanager.hybridcloud.models.HybridClouds; +import com.azure.resourcemanager.hybridcloud.models.Operation; + +public final class HybridCloudsImpl implements HybridClouds { + private static final ClientLogger LOGGER = new ClientLogger(HybridCloudsImpl.class); + + private final HybridCloudsClient innerClient; + + private final com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager; + + public HybridCloudsImpl( + HybridCloudsClient innerClient, com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listOperations() { + PagedIterable inner = this.serviceClient().listOperations(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable listOperations(Context context) { + PagedIterable inner = this.serviceClient().listOperations(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private HybridCloudsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.hybridcloud.HybridCloudManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/OperationImpl.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/OperationImpl.java new file mode 100644 index 000000000000..c3d9dd086978 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.implementation; + +import com.azure.resourcemanager.hybridcloud.fluent.models.OperationInner; +import com.azure.resourcemanager.hybridcloud.models.ActionType; +import com.azure.resourcemanager.hybridcloud.models.Operation; +import com.azure.resourcemanager.hybridcloud.models.OperationDisplay; +import com.azure.resourcemanager.hybridcloud.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.hybridcloud.HybridCloudManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.hybridcloud.HybridCloudManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/Utils.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/Utils.java new file mode 100644 index 000000000000..803c43a85ccb --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/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.hybridcloud.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/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/package-info.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/package-info.java new file mode 100644 index 000000000000..42f514ab6665 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for HybridCloudClient. Hybrid cloud connectivity Management API. */ +package com.azure.resourcemanager.hybridcloud.implementation; diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/ActionType.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/ActionType.java new file mode 100644 index 000000000000..9ea1c41f1df6 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/ActionType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/BodyContentType.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/BodyContentType.java new file mode 100644 index 000000000000..77b126ef19e5 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/BodyContentType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Content type of the cloud resource body. */ +public final class BodyContentType extends ExpandableStringEnum { + /** Static value Xml for BodyContentType. */ + public static final BodyContentType XML = fromString("Xml"); + + /** Static value Json for BodyContentType. */ + public static final BodyContentType JSON = fromString("Json"); + + /** + * Creates a new instance of BodyContentType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BodyContentType() { + } + + /** + * Creates or finds a BodyContentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding BodyContentType. + */ + @JsonCreator + public static BodyContentType fromString(String name) { + return fromString(name, BodyContentType.class); + } + + /** + * Gets known BodyContentType values. + * + * @return known BodyContentType values. + */ + public static Collection values() { + return values(BodyContentType.class); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnection.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnection.java new file mode 100644 index 000000000000..d0cc52368595 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnection.java @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridcloud.fluent.models.CloudConnectionInner; +import java.util.Map; + +/** An immutable client-side representation of CloudConnection. */ +public interface CloudConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the cloudConnector property: The cloud connector which discovered the remote resource. + * + * @return the cloudConnector value. + */ + ResourceReference cloudConnector(); + + /** + * Gets the remoteResourceId property: Identifier for the remote cloud resource. + * + * @return the remoteResourceId value. + */ + String remoteResourceId(); + + /** + * Gets the virtualHub property: The virtualHub to which the cloud connection belongs. + * + * @return the virtualHub value. + */ + ResourceReference virtualHub(); + + /** + * Gets the sharedKey property: Shared key of the cloud connection. + * + * @return the sharedKey value. + */ + String sharedKey(); + + /** + * Gets the provisioningState property: The provisioning state of the cloud collection resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.hybridcloud.fluent.models.CloudConnectionInner object. + * + * @return the inner object. + */ + CloudConnectionInner innerModel(); + + /** The entirety of the CloudConnection definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The CloudConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the CloudConnection definition. */ + interface Blank extends WithLocation { + } + /** The stage of the CloudConnection definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the CloudConnection 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 CloudConnection 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.WithCloudConnector, + DefinitionStages.WithRemoteResourceId, + DefinitionStages.WithVirtualHub, + DefinitionStages.WithSharedKey { + /** + * Executes the create request. + * + * @return the created resource. + */ + CloudConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CloudConnection create(Context context); + } + /** The stage of the CloudConnection 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 CloudConnection definition allowing to specify cloudConnector. */ + interface WithCloudConnector { + /** + * Specifies the cloudConnector property: The cloud connector which discovered the remote resource.. + * + * @param cloudConnector The cloud connector which discovered the remote resource. + * @return the next definition stage. + */ + WithCreate withCloudConnector(ResourceReference cloudConnector); + } + /** The stage of the CloudConnection definition allowing to specify remoteResourceId. */ + interface WithRemoteResourceId { + /** + * Specifies the remoteResourceId property: Identifier for the remote cloud resource. + * + * @param remoteResourceId Identifier for the remote cloud resource. + * @return the next definition stage. + */ + WithCreate withRemoteResourceId(String remoteResourceId); + } + /** The stage of the CloudConnection definition allowing to specify virtualHub. */ + interface WithVirtualHub { + /** + * Specifies the virtualHub property: The virtualHub to which the cloud connection belongs.. + * + * @param virtualHub The virtualHub to which the cloud connection belongs. + * @return the next definition stage. + */ + WithCreate withVirtualHub(ResourceReference virtualHub); + } + /** The stage of the CloudConnection definition allowing to specify sharedKey. */ + interface WithSharedKey { + /** + * Specifies the sharedKey property: Shared key of the cloud connection.. + * + * @param sharedKey Shared key of the cloud connection. + * @return the next definition stage. + */ + WithCreate withSharedKey(String sharedKey); + } + } + /** + * Begins update for the CloudConnection resource. + * + * @return the stage of resource update. + */ + CloudConnection.Update update(); + + /** The template for CloudConnection update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CloudConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CloudConnection apply(Context context); + } + /** The CloudConnection update stages. */ + interface UpdateStages { + /** The stage of the CloudConnection 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. + */ + CloudConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CloudConnection refresh(Context context); +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnectionListResult.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnectionListResult.java new file mode 100644 index 000000000000..1d065852a70c --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnectionListResult.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.hybridcloud.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.hybridcloud.fluent.models.CloudConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response for the ListCloudConnections API service call. */ +@Fluent +public final class CloudConnectionListResult { + /* + * A list of cloud connection resources. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to hold the next page of results + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of CloudConnectionListResult class. */ + public CloudConnectionListResult() { + } + + /** + * Get the value property: A list of cloud connection resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of cloud connection resources. + * + * @param value the value value to set. + * @return the CloudConnectionListResult object itself. + */ + public CloudConnectionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to hold the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link to hold the next page of results. + * + * @param nextLink the nextLink value to set. + * @return the CloudConnectionListResult object itself. + */ + public CloudConnectionListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnections.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnections.java new file mode 100644 index 000000000000..0457055fa9d3 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnections.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.hybridcloud.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 CloudConnections. */ +public interface CloudConnections { + /** + * Return list of cloud connections in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Return list of cloud connections in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Return list of cloud connections in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Return list of cloud connections in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnections API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the specified cloud connection in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection 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 specified cloud connection in a specified resource group along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String cloudConnectionName, Context context); + + /** + * Gets the specified cloud connection in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified cloud connection in a specified resource group. + */ + CloudConnection getByResourceGroup(String resourceGroupName, String cloudConnectionName); + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String cloudConnectionName); + + /** + * Deletes a specified cloud connection resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectionName The name of the cloud connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String cloudConnectionName, Context context); + + /** + * Gets the specified cloud connection in a specified resource group. + * + * @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 specified cloud connection in a specified resource group along with {@link Response}. + */ + CloudConnection getById(String id); + + /** + * Gets the specified cloud connection in a specified resource group. + * + * @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 specified cloud connection in a specified resource group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a specified cloud connection 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 a specified cloud connection 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 CloudConnection resource. + * + * @param name resource name. + * @return the first stage of the new CloudConnection definition. + */ + CloudConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnector.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnector.java new file mode 100644 index 000000000000..0992c921674d --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnector.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridcloud.fluent.models.CloudConnectorInner; +import java.util.Map; + +/** An immutable client-side representation of CloudConnector. */ +public interface CloudConnector { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the accountId property: Account identifier of the remote cloud. + * + * @return the accountId value. + */ + String accountId(); + + /** + * Gets the cloudType property: The cloud connector type. + * + * @return the cloudType value. + */ + CloudType cloudType(); + + /** + * Gets the provisioningState property: The provisioning state of the cloud connector resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.hybridcloud.fluent.models.CloudConnectorInner object. + * + * @return the inner object. + */ + CloudConnectorInner innerModel(); + + /** The entirety of the CloudConnector definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The CloudConnector definition stages. */ + interface DefinitionStages { + /** The first stage of the CloudConnector definition. */ + interface Blank extends WithLocation { + } + /** The stage of the CloudConnector definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the CloudConnector 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 CloudConnector 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.WithAccountId, DefinitionStages.WithCloudType { + /** + * Executes the create request. + * + * @return the created resource. + */ + CloudConnector create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CloudConnector create(Context context); + } + /** The stage of the CloudConnector 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 CloudConnector definition allowing to specify accountId. */ + interface WithAccountId { + /** + * Specifies the accountId property: Account identifier of the remote cloud.. + * + * @param accountId Account identifier of the remote cloud. + * @return the next definition stage. + */ + WithCreate withAccountId(String accountId); + } + /** The stage of the CloudConnector definition allowing to specify cloudType. */ + interface WithCloudType { + /** + * Specifies the cloudType property: The cloud connector type.. + * + * @param cloudType The cloud connector type. + * @return the next definition stage. + */ + WithCreate withCloudType(CloudType cloudType); + } + } + /** + * Begins update for the CloudConnector resource. + * + * @return the stage of resource update. + */ + CloudConnector.Update update(); + + /** The template for CloudConnector update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CloudConnector apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CloudConnector apply(Context context); + } + /** The CloudConnector update stages. */ + interface UpdateStages { + /** The stage of the CloudConnector 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. + */ + CloudConnector refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CloudConnector refresh(Context context); + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI to discover resources in remote cloud referred by the connector. + */ + DiscoveredResources discoverResources(); + + /** + * Returns a list of discovered remote cloud resources via this cloud connector 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 aPI to discover resources in remote cloud referred by the connector. + */ + DiscoveredResources discoverResources(Context context); +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnectorListResult.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnectorListResult.java new file mode 100644 index 000000000000..62d41a79ad1d --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnectorListResult.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.hybridcloud.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.hybridcloud.fluent.models.CloudConnectorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response for the ListCloudConnectors API service call. */ +@Fluent +public final class CloudConnectorListResult { + /* + * A list of cloud connector resources. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to hold the next page of results + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of CloudConnectorListResult class. */ + public CloudConnectorListResult() { + } + + /** + * Get the value property: A list of cloud connector resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of cloud connector resources. + * + * @param value the value value to set. + * @return the CloudConnectorListResult object itself. + */ + public CloudConnectorListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to hold the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link to hold the next page of results. + * + * @param nextLink the nextLink value to set. + * @return the CloudConnectorListResult object itself. + */ + public CloudConnectorListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnectors.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnectors.java new file mode 100644 index 000000000000..437ced053c1c --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudConnectors.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.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 CloudConnectors. */ +public interface CloudConnectors { + /** + * Return list of cloud connectors in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Return list of cloud connectors in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Return list of cloud connectors in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Return list of cloud connectors in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for the ListCloudConnectors API service call as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the specified cloud connector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 specified cloud connector in a specified resource group along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String cloudConnectorName, Context context); + + /** + * Gets the specified cloud connector in a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified cloud connector in a specified resource group. + */ + CloudConnector getByResourceGroup(String resourceGroupName, String cloudConnectorName); + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String cloudConnectorName); + + /** + * Deletes a specified cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String cloudConnectorName, Context context); + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI to discover resources in remote cloud referred by the connector. + */ + DiscoveredResources discoverResources(String resourceGroupName, String cloudConnectorName); + + /** + * Returns a list of discovered remote cloud resources via this cloud connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudConnectorName The name of the cloud connector 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 aPI to discover resources in remote cloud referred by the connector. + */ + DiscoveredResources discoverResources(String resourceGroupName, String cloudConnectorName, Context context); + + /** + * Gets the specified cloud connector in a specified resource group. + * + * @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 specified cloud connector in a specified resource group along with {@link Response}. + */ + CloudConnector getById(String id); + + /** + * Gets the specified cloud connector in a specified resource group. + * + * @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 specified cloud connector in a specified resource group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a specified cloud connector 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 a specified cloud connector 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 CloudConnector resource. + * + * @param name resource name. + * @return the first stage of the new CloudConnector definition. + */ + CloudConnector.DefinitionStages.Blank define(String name); +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudType.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudType.java new file mode 100644 index 000000000000..33e88eda32d6 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/CloudType.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.hybridcloud.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The cloud connector type. */ +public final class CloudType extends ExpandableStringEnum { + /** Static value AWS for CloudType. */ + public static final CloudType AWS = fromString("AWS"); + + /** + * Creates a new instance of CloudType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CloudType() { + } + + /** + * Creates or finds a CloudType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CloudType. + */ + @JsonCreator + public static CloudType fromString(String name) { + return fromString(name, CloudType.class); + } + + /** + * Gets known CloudType values. + * + * @return known CloudType values. + */ + public static Collection values() { + return values(CloudType.class); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/DiscoveredResource.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/DiscoveredResource.java new file mode 100644 index 000000000000..0831014510e6 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/DiscoveredResource.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Discovered Resource properties. */ +@Immutable +public final class DiscoveredResource { + /* + * Remote cloud resource identifier + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Content type of the cloud resource body. + */ + @JsonProperty(value = "bodyContentType", access = JsonProperty.Access.WRITE_ONLY) + private BodyContentType bodyContentType; + + /* + * Properties of the remote cloud resource. + */ + @JsonProperty(value = "body", access = JsonProperty.Access.WRITE_ONLY) + private String body; + + /** Creates an instance of DiscoveredResource class. */ + public DiscoveredResource() { + } + + /** + * Get the id property: Remote cloud resource identifier. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the bodyContentType property: Content type of the cloud resource body. + * + * @return the bodyContentType value. + */ + public BodyContentType bodyContentType() { + return this.bodyContentType; + } + + /** + * Get the body property: Properties of the remote cloud resource. + * + * @return the body value. + */ + public String body() { + return this.body; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/DiscoveredResources.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/DiscoveredResources.java new file mode 100644 index 000000000000..16908e4234a8 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/DiscoveredResources.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.hybridcloud.models; + +import com.azure.resourcemanager.hybridcloud.fluent.models.DiscoveredResourcesInner; +import java.util.List; + +/** An immutable client-side representation of DiscoveredResources. */ +public interface DiscoveredResources { + /** + * Gets the discoveredResources property: List of discovered remote cloud resources. + * + * @return the discoveredResources value. + */ + List discoveredResources(); + + /** + * Gets the name property: Remote Resource name to filter on. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Remote Resource type to filter on. + * + * @return the type value. + */ + String type(); + + /** + * Gets the region property: Remote Resource location/region to filter on. + * + * @return the region value. + */ + String region(); + + /** + * Gets the tag property: Remote Resource tags to filter on in key:value format. + * + * @return the tag value. + */ + String tag(); + + /** + * Gets the inner com.azure.resourcemanager.hybridcloud.fluent.models.DiscoveredResourcesInner object. + * + * @return the inner object. + */ + DiscoveredResourcesInner innerModel(); +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/HybridClouds.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/HybridClouds.java new file mode 100644 index 000000000000..4e9f26298a1d --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/HybridClouds.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of HybridClouds. */ +public interface HybridClouds { + /** + * Lists all of the available HybridCloud Rest API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listOperations(); + + /** + * Lists all of the available HybridCloud Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listOperations(Context context); +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/Operation.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/Operation.java new file mode 100644 index 000000000000..d5576cd685c1 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/Operation.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.models; + +import com.azure.resourcemanager.hybridcloud.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.hybridcloud.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/OperationDisplay.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/OperationDisplay.java new file mode 100644 index 000000000000..0c1885d459f7 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/OperationDisplay.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + * Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + * Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + * Machine", "Restart Virtual Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/OperationListResult.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/OperationListResult.java new file mode 100644 index 000000000000..202edb4ef3fd --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/OperationListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.hybridcloud.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/Origin.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/Origin.java new file mode 100644 index 000000000000..678f18ac7074 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/Origin.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/ProvisioningState.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/ProvisioningState.java new file mode 100644 index 000000000000..9722b9de7b0c --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/ProvisioningState.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The current provisioning state. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/ResourceReference.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/ResourceReference.java new file mode 100644 index 000000000000..bdaf224192a5 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/ResourceReference.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.hybridcloud.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource reference properties. */ +@Fluent +public final class ResourceReference { + /* + * Resource ID. + */ + @JsonProperty(value = "id") + private String id; + + /** Creates an instance of ResourceReference class. */ + public ResourceReference() { + } + + /** + * Get the id property: Resource ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource ID. + * + * @param id the id value to set. + * @return the ResourceReference object itself. + */ + public ResourceReference withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/TagsObject.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/TagsObject.java new file mode 100644 index 000000000000..a1384fa8ad64 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/TagsObject.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.hybridcloud.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Tags object for patch operations. */ +@Fluent +public final class TagsObject { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of TagsObject class. */ + public TagsObject() { + } + + /** + * 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 TagsObject object itself. + */ + public TagsObject 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/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/package-info.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/package-info.java new file mode 100644 index 000000000000..5678cf05d5a9 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for HybridCloudClient. Hybrid cloud connectivity Management API. */ +package com.azure.resourcemanager.hybridcloud.models; diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/package-info.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/package-info.java new file mode 100644 index 000000000000..696cf23e0b77 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/com/azure/resourcemanager/hybridcloud/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for HybridCloudClient. Hybrid cloud connectivity Management API. */ +package com.azure.resourcemanager.hybridcloud; diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/module-info.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/main/java/module-info.java new file mode 100644 index 000000000000..1c0ba1505388 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/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.hybridcloud { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.hybridcloud; + exports com.azure.resourcemanager.hybridcloud.fluent; + exports com.azure.resourcemanager.hybridcloud.fluent.models; + exports com.azure.resourcemanager.hybridcloud.models; + + opens com.azure.resourcemanager.hybridcloud.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.hybridcloud.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsCreateOrUpdateSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..69a72923346e --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsCreateOrUpdateSamples.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.hybridcloud.generated; + +import com.azure.resourcemanager.hybridcloud.models.ResourceReference; + +/** Samples for CloudConnections CreateOrUpdate. */ +public final class CloudConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectionCreate.json + */ + /** + * Sample code: Create a Cloud Connection. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void createACloudConnection(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager + .cloudConnections() + .define("cloudconnection1") + .withRegion("West US") + .withExistingResourceGroup("demo-rg") + .withCloudConnector( + new ResourceReference() + .withId( + "/subscriptions/subid/resourceGroups/demo-rg/providers/Microsoft.HybridCloud/cloudConnectors/123456789012")) + .withRemoteResourceId("arn:aws:ec2:us-east-1:123456789012:VPNGateway/vgw-043da592550819c8a") + .withVirtualHub( + new ResourceReference() + .withId( + "/subscriptions/subid/resourceGroups/demo-rg/providers/Microsoft.Network/VirtualHubs/testHub")) + .withSharedKey("password123") + .create(); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsDeleteSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsDeleteSamples.java new file mode 100644 index 000000000000..931d4cbefdb6 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.generated; + +/** Samples for CloudConnections Delete. */ +public final class CloudConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectionDelete.json + */ + /** + * Sample code: Delete Cloud Connection. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void deleteCloudConnection(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnections().delete("demo-rg", "cloudconnection1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsGetByResourceGroupSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..bf6087143bf3 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsGetByResourceGroupSamples.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.hybridcloud.generated; + +/** Samples for CloudConnections GetByResourceGroup. */ +public final class CloudConnectionsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectionGet.json + */ + /** + * Sample code: Get Cloud Connection. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void getCloudConnection(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager + .cloudConnections() + .getByResourceGroupWithResponse("demo-rg", "cloudConnection1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsListByResourceGroupSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsListByResourceGroupSamples.java new file mode 100644 index 000000000000..4b9aae48b358 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.generated; + +/** Samples for CloudConnections ListByResourceGroup. */ +public final class CloudConnectionsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectionsByResourceGroupList.json + */ + /** + * Sample code: List of Cloud Connections by ResourceGroup. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void listOfCloudConnectionsByResourceGroup( + com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnections().listByResourceGroup("demo-rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsListSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsListSamples.java new file mode 100644 index 000000000000..e2bbdf507028 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.generated; + +/** Samples for CloudConnections List. */ +public final class CloudConnectionsListSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectionsBySubscriptionList.json + */ + /** + * Sample code: List of Cloud Connections by Subscription. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void listOfCloudConnectionsBySubscription( + com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnections().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsUpdateTagsSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsUpdateTagsSamples.java new file mode 100644 index 000000000000..67d4f342b15d --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectionsUpdateTagsSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.generated; + +import com.azure.resourcemanager.hybridcloud.models.CloudConnection; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CloudConnections UpdateTags. */ +public final class CloudConnectionsUpdateTagsSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectionUpdateTags.json + */ + /** + * Sample code: Update Cloud Connections tags. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void updateCloudConnectionsTags(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + CloudConnection resource = + manager + .cloudConnections() + .getByResourceGroupWithResponse("demo-rg", "cloudConnection1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "value1", "key2", "value2")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsCreateOrUpdateSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..db9b172a793a --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.generated; + +import com.azure.resourcemanager.hybridcloud.models.CloudType; + +/** Samples for CloudConnectors CreateOrUpdate. */ +public final class CloudConnectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorCreate.json + */ + /** + * Sample code: Create a Cloud Connector. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void createACloudConnector(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager + .cloudConnectors() + .define("123456789012") + .withRegion("West US") + .withExistingResourceGroup("demo-rg") + .withAccountId("123456789012") + .withCloudType(CloudType.AWS) + .create(); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsDeleteSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsDeleteSamples.java new file mode 100644 index 000000000000..531b89d69106 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.generated; + +/** Samples for CloudConnectors Delete. */ +public final class CloudConnectorsDeleteSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorDelete.json + */ + /** + * Sample code: Delete Cloud Connector. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void deleteCloudConnector(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnectors().delete("demo-rg", "123456789012", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsDiscoverResourcesSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsDiscoverResourcesSamples.java new file mode 100644 index 000000000000..82f56ea7e6d9 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsDiscoverResourcesSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.generated; + +/** Samples for CloudConnectors DiscoverResources. */ +public final class CloudConnectorsDiscoverResourcesSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorDiscoverResources.json + */ + /** + * Sample code: Get remote cloud resources by Cloud Connector. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void getRemoteCloudResourcesByCloudConnector( + com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnectors().discoverResources("demo-rg", "123456789012", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsGetByResourceGroupSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..4570854bc912 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsGetByResourceGroupSamples.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.hybridcloud.generated; + +/** Samples for CloudConnectors GetByResourceGroup. */ +public final class CloudConnectorsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorGet.json + */ + /** + * Sample code: Get Cloud Connector. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void getCloudConnector(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager + .cloudConnectors() + .getByResourceGroupWithResponse("demo-rg", "123456789012", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsListByResourceGroupSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsListByResourceGroupSamples.java new file mode 100644 index 000000000000..771cf4e685ae --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.generated; + +/** Samples for CloudConnectors ListByResourceGroup. */ +public final class CloudConnectorsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorsByResourceGroupList.json + */ + /** + * Sample code: List of Cloud Connectors by ResourceGroup. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void listOfCloudConnectorsByResourceGroup( + com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnectors().listByResourceGroup("demo-rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsListSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsListSamples.java new file mode 100644 index 000000000000..a5fb0ffab800 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.generated; + +/** Samples for CloudConnectors List. */ +public final class CloudConnectorsListSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorsBySubscriptionList.json + */ + /** + * Sample code: List of Cloud Connectors by Subscription. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void listOfCloudConnectorsBySubscription( + com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.cloudConnectors().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsUpdateTagsSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsUpdateTagsSamples.java new file mode 100644 index 000000000000..daa8a05f8fde --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/CloudConnectorsUpdateTagsSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.generated; + +import com.azure.resourcemanager.hybridcloud.models.CloudConnector; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CloudConnectors UpdateTags. */ +public final class CloudConnectorsUpdateTagsSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/CloudConnectorUpdateTags.json + */ + /** + * Sample code: Update Cloud Connector tags. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void updateCloudConnectorTags(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + CloudConnector resource = + manager + .cloudConnectors() + .getByResourceGroupWithResponse("demo-rg", "123456789012", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "value1", "key2", "value2")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/HybridCloudListOperationsSamples.java b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/HybridCloudListOperationsSamples.java new file mode 100644 index 000000000000..3586d1b61eb4 --- /dev/null +++ b/sdk/hybridcloud/azure-resourcemanager-hybridcloud/src/samples/java/com/azure/resourcemanager/hybridcloud/generated/HybridCloudListOperationsSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcloud.generated; + +/** Samples for HybridCloud ListOperations. */ +public final class HybridCloudListOperationsSamples { + /* + * x-ms-original-file: specification/hybridcloud/resource-manager/Microsoft.HybridCloud/preview/2023-01-01-preview/examples/OperationGroupGet.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to HybridCloudManager. + */ + public static void operationsList(com.azure.resourcemanager.hybridcloud.HybridCloudManager manager) { + manager.hybridClouds().listOperations(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hybridcloud/ci.yml b/sdk/hybridcloud/ci.yml new file mode 100644 index 000000000000..e65f5f8c1cf2 --- /dev/null +++ b/sdk/hybridcloud/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/hybridcloud/ci.yml + - sdk/hybridcloud/azure-resourcemanager-hybridcloud/ + exclude: + - sdk/hybridcloud/pom.xml + - sdk/hybridcloud/azure-resourcemanager-hybridcloud/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridcloud/ci.yml + - sdk/hybridcloud/azure-resourcemanager-hybridcloud/ + exclude: + - sdk/hybridcloud/pom.xml + - sdk/hybridcloud/azure-resourcemanager-hybridcloud/pom.xml + +parameters: + - name: release_azureresourcemanagerhybridcloud + displayName: azure-resourcemanager-hybridcloud + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: hybridcloud + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-hybridcloud + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerhybridcloud + releaseInBatch: ${{ parameters.release_azureresourcemanagerhybridcloud }} diff --git a/sdk/hybridcloud/pom.xml b/sdk/hybridcloud/pom.xml new file mode 100644 index 000000000000..496bc1e47f21 --- /dev/null +++ b/sdk/hybridcloud/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-hybridcloud-service + pom + 1.0.0 + + + azure-resourcemanager-hybridcloud + +