diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 904f58c5b88b..720e92c2f933 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -470,6 +470,7 @@ com.azure.resourcemanager:azure-resourcemanager-computefleet;1.0.0-beta.2;1.0.0- com.azure.resourcemanager:azure-resourcemanager-servicefabricmanagedclusters;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-healthdataaiservices;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-redhatopenshift;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-programmableconnectivity;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;1.1.0-beta.1 io.clientcore:clientcore-parent;1.0.0-beta.1;1.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 3f4214576905..63c1c3c2213c 100644 --- a/pom.xml +++ b/pom.xml @@ -164,6 +164,7 @@ sdk/postgresql sdk/postgresqlflexibleserver sdk/powerbidedicated + sdk/programmableconnectivity sdk/providerhub sdk/purview sdk/quantum diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/CHANGELOG.md b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/CHANGELOG.md new file mode 100644 index 000000000000..206951f54bae --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2024-09-12) + +- Azure Resource Manager ProgrammableConnectivity client library for Java. This package contains Microsoft Azure SDK for ProgrammableConnectivity Management SDK. Azure Programmable Connectivity Provider management API. Package tag package-2024-01-15-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-programmableconnectivity Java SDK. diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/README.md b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/README.md new file mode 100644 index 000000000000..9905b54cb449 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/README.md @@ -0,0 +1,104 @@ +# Azure Resource Manager ProgrammableConnectivity client library for Java + +Azure Resource Manager ProgrammableConnectivity client library for Java. + +This package contains Microsoft Azure SDK for ProgrammableConnectivity Management SDK. Azure Programmable Connectivity Provider management API. Package tag package-2024-01-15-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-programmableconnectivity;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-programmableconnectivity + 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 + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ProgrammableConnectivityManager manager = ProgrammableConnectivityManager + .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/programmableconnectivity/azure-resourcemanager-programmableconnectivity/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://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[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/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fprogrammableconnectivity%2Fazure-resourcemanager-programmableconnectivity%2FREADME.png) diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/SAMPLE.md b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/SAMPLE.md new file mode 100644 index 000000000000..c75f8f634549 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/SAMPLE.md @@ -0,0 +1,505 @@ +# Code snippets and samples + + +## Gateways + +- [CreateOrUpdate](#gateways_createorupdate) +- [Delete](#gateways_delete) +- [GetByResourceGroup](#gateways_getbyresourcegroup) +- [List](#gateways_list) +- [ListByResourceGroup](#gateways_listbyresourcegroup) +- [Update](#gateways_update) + +## Operations + +- [List](#operations_list) + +## OperatorApiConnections + +- [Create](#operatorapiconnections_create) +- [Delete](#operatorapiconnections_delete) +- [GetByResourceGroup](#operatorapiconnections_getbyresourcegroup) +- [List](#operatorapiconnections_list) +- [ListByResourceGroup](#operatorapiconnections_listbyresourcegroup) +- [Update](#operatorapiconnections_update) + +## OperatorApiPlans + +- [Get](#operatorapiplans_get) +- [List](#operatorapiplans_list) +### Gateways_CreateOrUpdate + +```java +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Gateways CreateOrUpdate. + */ +public final class GatewaysCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Gateways_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_CreateOrUpdate. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysCreateOrUpdate( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways() + .define("pgzk") + .withRegion("oryhozfmeohscezl") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("key2642", "fakeTokenPlaceholder")) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Gateways_Delete + +```java +/** + * Samples for Gateways Delete. + */ +public final class GatewaysDeleteSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Gateways_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: Gateways_Delete. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void + gatewaysDelete(com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways().delete("rgopenapi", "udveaau", com.azure.core.util.Context.NONE); + } +} +``` + +### Gateways_GetByResourceGroup + +```java +/** + * Samples for Gateways GetByResourceGroup. + */ +public final class GatewaysGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Gateways_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_Get. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void + gatewaysGet(com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways() + .getByResourceGroupWithResponse("rgopenapi", "kdgpdkrucfphqtgafao", com.azure.core.util.Context.NONE); + } +} +``` + +### Gateways_List + +```java +/** + * Samples for Gateways List. + */ +public final class GatewaysListSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Gateways_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_ListBySubscription. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysListBySubscription( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Gateways_ListByResourceGroup + +```java +/** + * Samples for Gateways ListByResourceGroup. + */ +public final class GatewaysListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Gateways_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_ListByResourceGroup. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysListByResourceGroup( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} +``` + +### Gateways_Update + +```java +import com.azure.resourcemanager.programmableconnectivity.models.Gateway; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Gateways Update. + */ +public final class GatewaysUpdateSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Gateways_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_Update. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void + gatewaysUpdate(com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + Gateway resource = manager.gateways() + .getByResourceGroupWithResponse("rgopenapi", "pgzk", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key2642", "fakeTokenPlaceholder")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void + operationsList(com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### OperatorApiConnections_Create + +```java +import com.azure.resourcemanager.programmableconnectivity.models.AccountType; +import com.azure.resourcemanager.programmableconnectivity.models.ApplicationProperties; +import com.azure.resourcemanager.programmableconnectivity.models.SaasProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for OperatorApiConnections Create. + */ +public final class OperatorApiConnectionsCreateSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiConnections_Create_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Create. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsCreate( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections() + .define("nzsdg") + .withRegion("dwvzfkjoepbmksygazllqryyinn") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("key5536", "fakeTokenPlaceholder")) + .withOperatorApiPlanId( + "/subscriptions/00000000-0000-0000-0000-00000000000/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans/livmzrh") + .withSaasProperties( + new SaasProperties().withSaasSubscriptionId("mgyusmqt").withSaasResourceId("pekejefyvfviabimdrmno")) + .withConfiguredApplication(new ApplicationProperties().withName("idzqqen") + .withApplicationDescription("gjlwegnqvffvsc") + .withApplicationType("f") + .withLegalName("ar") + .withOrganizationDescription("fcueqzlxxr") + .withTaxNumber("ngzv") + .withPrivacyContactEmailAddress("l")) + .withAppId("czgrhbvgr") + .withGatewayId( + "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/example-rg/providers/Microsoft.ProgrammableConnectivity/gateways/cdvcixxcdhjqw") + .withAccountType(AccountType.AZURE_MANAGED) + .withAppSecret("wtxnpes") + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### OperatorApiConnections_Delete + +```java +/** + * Samples for OperatorApiConnections Delete. + */ +public final class OperatorApiConnectionsDeleteSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiConnections_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Delete. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsDelete( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections().delete("rgopenapi", "dawr", com.azure.core.util.Context.NONE); + } +} +``` + +### OperatorApiConnections_GetByResourceGroup + +```java +/** + * Samples for OperatorApiConnections GetByResourceGroup. + */ +public final class OperatorApiConnectionsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiConnections_Get_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Get. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsGet( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections() + .getByResourceGroupWithResponse("rgopenapi", "uetzqjrwqtkwgcirdqy", com.azure.core.util.Context.NONE); + } +} +``` + +### OperatorApiConnections_List + +```java +/** + * Samples for OperatorApiConnections List. + */ +public final class OperatorApiConnectionsListSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiConnections_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_ListBySubscription. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsListBySubscription( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections().list(com.azure.core.util.Context.NONE); + } +} +``` + +### OperatorApiConnections_ListByResourceGroup + +```java +/** + * Samples for OperatorApiConnections ListByResourceGroup. + */ +public final class OperatorApiConnectionsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiConnections_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_ListByResourceGroup. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsListByResourceGroup( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} +``` + +### OperatorApiConnections_Update + +```java +import com.azure.resourcemanager.programmableconnectivity.models.ApplicationProperties; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnection; +import com.azure.resourcemanager.programmableconnectivity.models.SaasProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for OperatorApiConnections Update. + */ +public final class OperatorApiConnectionsUpdateSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiConnections_Update_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Update. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsUpdate( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + OperatorApiConnection resource = manager.operatorApiConnections() + .getByResourceGroupWithResponse("rgopenapi", "syefewgf", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key3150", "fakeTokenPlaceholder")) + .withOperatorApiPlanId( + "/subscriptions/00000000-0000-0000-0000-00000000000/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans/yhlygxdwvrzgazbfzyz") + .withSaasProperties( + new SaasProperties().withSaasSubscriptionId("mgyusmqt").withSaasResourceId("pekejefyvfviabimdrmno")) + .withConfiguredApplication(new ApplicationProperties().withName("idzqqen") + .withApplicationDescription("gjlwegnqvffvsc") + .withApplicationType("f") + .withLegalName("ar") + .withOrganizationDescription("fcueqzlxxr") + .withTaxNumber("ngzv") + .withPrivacyContactEmailAddress("l")) + .withAppId("mkfcrn") + .withAppSecret("wtxnpes") + .apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### OperatorApiPlans_Get + +```java +/** + * Samples for OperatorApiPlans Get. + */ +public final class OperatorApiPlansGetSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiPlans_Get_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiPlans_Get. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiPlansGet( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiPlans().getWithResponse("etzfxkqegslnxdhdmzvbtzxahnyq", com.azure.core.util.Context.NONE); + } +} +``` + +### OperatorApiPlans_List + +```java +/** + * Samples for OperatorApiPlans List. + */ +public final class OperatorApiPlansListSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiPlans_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiPlans_ListBySubscription. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiPlansListBySubscription( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiPlans().list(null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/pom.xml b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/pom.xml new file mode 100644 index 000000000000..a4e1502c3b3f --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-programmableconnectivity + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for ProgrammableConnectivity Management + This package contains Microsoft Azure SDK for ProgrammableConnectivity Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Programmable Connectivity Provider management API. Package tag package-2024-01-15-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 + true + + + + com.azure + azure-json + 1.2.0 + + + com.azure + azure-core + 1.51.0 + + + com.azure + azure-core-management + 1.15.2 + + + diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/ProgrammableConnectivityManager.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/ProgrammableConnectivityManager.java new file mode 100644 index 000000000000..c1b86fdf54d6 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/ProgrammableConnectivityManager.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity; + +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.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpLogOptions; +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.programmableconnectivity.fluent.ProgrammableConnectivity; +import com.azure.resourcemanager.programmableconnectivity.implementation.GatewaysImpl; +import com.azure.resourcemanager.programmableconnectivity.implementation.OperationsImpl; +import com.azure.resourcemanager.programmableconnectivity.implementation.OperatorApiConnectionsImpl; +import com.azure.resourcemanager.programmableconnectivity.implementation.OperatorApiPlansImpl; +import com.azure.resourcemanager.programmableconnectivity.implementation.ProgrammableConnectivityBuilder; +import com.azure.resourcemanager.programmableconnectivity.models.Gateways; +import com.azure.resourcemanager.programmableconnectivity.models.Operations; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnections; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiPlans; +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 ProgrammableConnectivityManager. + * Azure Programmable Connectivity Provider management API. + */ +public final class ProgrammableConnectivityManager { + private Operations operations; + + private Gateways gateways; + + private OperatorApiConnections operatorApiConnections; + + private OperatorApiPlans operatorApiPlans; + + private final ProgrammableConnectivity clientObject; + + private ProgrammableConnectivityManager(HttpPipeline httpPipeline, AzureProfile profile, + Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ProgrammableConnectivityBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ProgrammableConnectivity service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ProgrammableConnectivity service API instance. + */ + public static ProgrammableConnectivityManager 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 ProgrammableConnectivity service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ProgrammableConnectivity service API instance. + */ + public static ProgrammableConnectivityManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ProgrammableConnectivityManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ProgrammableConnectivityManager with optional + * configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ProgrammableConnectivityManager.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 ProgrammableConnectivity service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ProgrammableConnectivity service API instance. + */ + public ProgrammableConnectivityManager 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.programmableconnectivity") + .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 ProgrammableConnectivityManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of Gateways. It manages Gateway. + * + * @return Resource collection API of Gateways. + */ + public Gateways gateways() { + if (this.gateways == null) { + this.gateways = new GatewaysImpl(clientObject.getGateways(), this); + } + return gateways; + } + + /** + * Gets the resource collection API of OperatorApiConnections. It manages OperatorApiConnection. + * + * @return Resource collection API of OperatorApiConnections. + */ + public OperatorApiConnections operatorApiConnections() { + if (this.operatorApiConnections == null) { + this.operatorApiConnections + = new OperatorApiConnectionsImpl(clientObject.getOperatorApiConnections(), this); + } + return operatorApiConnections; + } + + /** + * Gets the resource collection API of OperatorApiPlans. + * + * @return Resource collection API of OperatorApiPlans. + */ + public OperatorApiPlans operatorApiPlans() { + if (this.operatorApiPlans == null) { + this.operatorApiPlans = new OperatorApiPlansImpl(clientObject.getOperatorApiPlans(), this); + } + return operatorApiPlans; + } + + /** + * Gets wrapped service client ProgrammableConnectivity providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client ProgrammableConnectivity. + */ + public ProgrammableConnectivity serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/GatewaysClient.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/GatewaysClient.java new file mode 100644 index 000000000000..fbba25b69fa3 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/GatewaysClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.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.programmableconnectivity.fluent.models.GatewayInner; +import com.azure.resourcemanager.programmableconnectivity.models.GatewayTagsUpdate; + +/** + * An instance of this class provides access to all the operations defined in GatewaysClient. + */ +public interface GatewaysClient { + /** + * List Gateway resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List Gateway resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List Gateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Gateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a Gateway resource by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Gateway resource by name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String gatewayName, + Context context); + + /** + * Get a Gateway resource by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Gateway resource by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GatewayInner getByResourceGroup(String resourceGroupName, String gatewayName); + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Programmable Connectivity Gateway resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GatewayInner> beginCreateOrUpdate(String resourceGroupName, String gatewayName, + GatewayInner resource); + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Programmable Connectivity Gateway resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GatewayInner> beginCreateOrUpdate(String resourceGroupName, String gatewayName, + GatewayInner resource, Context context); + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GatewayInner createOrUpdate(String resourceGroupName, String gatewayName, GatewayInner resource); + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GatewayInner createOrUpdate(String resourceGroupName, String gatewayName, GatewayInner resource, Context context); + + /** + * Update Gateway tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String gatewayName, + GatewayTagsUpdate properties, Context context); + + /** + * Update Gateway tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GatewayInner update(String resourceGroupName, String gatewayName, GatewayTagsUpdate properties); + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String gatewayName); + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String gatewayName, Context context); + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String gatewayName); + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String gatewayName, Context context); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/OperationsClient.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/OperationsClient.java new file mode 100644 index 000000000000..83fbb1fa5e85 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/OperationsClient.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.programmableconnectivity.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.programmableconnectivity.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/OperatorApiConnectionsClient.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/OperatorApiConnectionsClient.java new file mode 100644 index 000000000000..742960672eeb --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/OperatorApiConnectionsClient.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.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.programmableconnectivity.fluent.models.OperatorApiConnectionInner; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnectionUpdate; + +/** + * An instance of this class provides access to all the operations defined in OperatorApiConnectionsClient. + */ +public interface OperatorApiConnectionsClient { + /** + * List OperatorApiConnection resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List OperatorApiConnection resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List OperatorApiConnection resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List OperatorApiConnection resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Operator API Connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String operatorApiConnectionName, Context context); + + /** + * Get an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Operator API Connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperatorApiConnectionInner getByResourceGroup(String resourceGroupName, String operatorApiConnectionName); + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OperatorApiConnectionInner> beginCreate(String resourceGroupName, + String operatorApiConnectionName, OperatorApiConnectionInner resource); + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OperatorApiConnectionInner> beginCreate(String resourceGroupName, + String operatorApiConnectionName, OperatorApiConnectionInner resource, Context context); + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperatorApiConnectionInner create(String resourceGroupName, String operatorApiConnectionName, + OperatorApiConnectionInner resource); + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperatorApiConnectionInner create(String resourceGroupName, String operatorApiConnectionName, + OperatorApiConnectionInner resource, Context context); + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OperatorApiConnectionInner> beginUpdate(String resourceGroupName, + String operatorApiConnectionName, OperatorApiConnectionUpdate properties); + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OperatorApiConnectionInner> beginUpdate(String resourceGroupName, + String operatorApiConnectionName, OperatorApiConnectionUpdate properties, Context context); + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperatorApiConnectionInner update(String resourceGroupName, String operatorApiConnectionName, + OperatorApiConnectionUpdate properties); + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperatorApiConnectionInner update(String resourceGroupName, String operatorApiConnectionName, + OperatorApiConnectionUpdate properties, Context context); + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String operatorApiConnectionName); + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String operatorApiConnectionName, + Context context); + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String operatorApiConnectionName); + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String operatorApiConnectionName, Context context); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/OperatorApiPlansClient.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/OperatorApiPlansClient.java new file mode 100644 index 000000000000..68c8aadfeae3 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/OperatorApiPlansClient.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.programmableconnectivity.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiPlanInner; + +/** + * An instance of this class provides access to all the operations defined in OperatorApiPlansClient. + */ +public interface OperatorApiPlansClient { + /** + * List OperatorApiPlan resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiPlan list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List OperatorApiPlan resources by subscription ID. + * + * @param filter An optional OData based filter expression to apply on the operation. + * @param top An optional query parameter which specifies the maximum number of records to be returned. + * @param skip An optional query parameter which specifies the number of records to be skipped. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiPlan list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Integer top, Integer skip, Context context); + + /** + * Get an OperatorApiPlan resource by name. + * + * @param operatorApiPlanName APC Gateway Plan Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an OperatorApiPlan resource by name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String operatorApiPlanName, Context context); + + /** + * Get an OperatorApiPlan resource by name. + * + * @param operatorApiPlanName APC Gateway Plan Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an OperatorApiPlan resource by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperatorApiPlanInner get(String operatorApiPlanName); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/ProgrammableConnectivity.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/ProgrammableConnectivity.java new file mode 100644 index 000000000000..5c0c7dda4a9a --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/ProgrammableConnectivity.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ProgrammableConnectivity class. + */ +public interface ProgrammableConnectivity { + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the GatewaysClient object to access its operations. + * + * @return the GatewaysClient object. + */ + GatewaysClient getGateways(); + + /** + * Gets the OperatorApiConnectionsClient object to access its operations. + * + * @return the OperatorApiConnectionsClient object. + */ + OperatorApiConnectionsClient getOperatorApiConnections(); + + /** + * Gets the OperatorApiPlansClient object to access its operations. + * + * @return the OperatorApiPlansClient object. + */ + OperatorApiPlansClient getOperatorApiPlans(); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/GatewayInner.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/GatewayInner.java new file mode 100644 index 000000000000..19e0775b18f9 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/GatewayInner.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.models.ProvisioningState; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * A Programmable Connectivity Gateway resource. + */ +@Fluent +public final class GatewayInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private GatewayProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of GatewayInner class. + */ + public GatewayInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private GatewayProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public GatewayInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public GatewayInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the operatorApiConnections property: List of Operator API Connections selected by the user. + * + * @return the operatorApiConnections value. + */ + public List operatorApiConnections() { + return this.innerProperties() == null ? null : this.innerProperties().operatorApiConnections(); + } + + /** + * Get the gatewayBaseUrl property: Base URL of the Gateway resource. This is the URL that the users would use to + * make Open API Gateway requests to the Operators via Azure. + * + * @return the gatewayBaseUrl value. + */ + public String gatewayBaseUrl() { + return this.innerProperties() == null ? null : this.innerProperties().gatewayBaseUrl(); + } + + /** + * Get the provisioningState property: The status of the last operation on the Gateway 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(); + } + if (location() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property location in model GatewayInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GatewayInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GatewayInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GatewayInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GatewayInner. + */ + public static GatewayInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GatewayInner deserializedGatewayInner = new GatewayInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGatewayInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGatewayInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGatewayInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedGatewayInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedGatewayInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedGatewayInner.innerProperties = GatewayProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedGatewayInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGatewayInner; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/GatewayProperties.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/GatewayProperties.java new file mode 100644 index 000000000000..e9b8ad78eb8d --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/GatewayProperties.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.models.ProvisioningState; +import java.io.IOException; +import java.util.List; + +/** + * Gateway resource properties. + */ +@Immutable +public final class GatewayProperties implements JsonSerializable { + /* + * List of Operator API Connections selected by the user + */ + private List operatorApiConnections; + + /* + * Base URL of the Gateway resource. This is the URL that the users would use to make Open API Gateway requests to + * the Operators via Azure. + */ + private String gatewayBaseUrl; + + /* + * The status of the last operation on the Gateway resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of GatewayProperties class. + */ + public GatewayProperties() { + } + + /** + * Get the operatorApiConnections property: List of Operator API Connections selected by the user. + * + * @return the operatorApiConnections value. + */ + public List operatorApiConnections() { + return this.operatorApiConnections; + } + + /** + * Get the gatewayBaseUrl property: Base URL of the Gateway resource. This is the URL that the users would use to + * make Open API Gateway requests to the Operators via Azure. + * + * @return the gatewayBaseUrl value. + */ + public String gatewayBaseUrl() { + return this.gatewayBaseUrl; + } + + /** + * Get the provisioningState property: The status of the last operation on the Gateway 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GatewayProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GatewayProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the GatewayProperties. + */ + public static GatewayProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GatewayProperties deserializedGatewayProperties = new GatewayProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operatorApiConnections".equals(fieldName)) { + List operatorApiConnections = reader.readArray(reader1 -> reader1.getString()); + deserializedGatewayProperties.operatorApiConnections = operatorApiConnections; + } else if ("gatewayBaseUrl".equals(fieldName)) { + deserializedGatewayProperties.gatewayBaseUrl = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedGatewayProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGatewayProperties; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperationInner.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperationInner.java new file mode 100644 index 000000000000..a50f62d16c3a --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperationInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.models.ActionType; +import com.azure.resourcemanager.programmableconnectivity.models.OperationDisplay; +import com.azure.resourcemanager.programmableconnectivity.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + 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" + */ + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiConnectionInner.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiConnectionInner.java new file mode 100644 index 000000000000..e6a08814fade --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiConnectionInner.java @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.models.AccountType; +import com.azure.resourcemanager.programmableconnectivity.models.ApplicationProperties; +import com.azure.resourcemanager.programmableconnectivity.models.ProvisioningState; +import com.azure.resourcemanager.programmableconnectivity.models.SaasProperties; +import com.azure.resourcemanager.programmableconnectivity.models.Status; +import java.io.IOException; +import java.util.Map; + +/** + * A Programmable Connectivity Operator API Connection resource. + */ +@Fluent +public final class OperatorApiConnectionInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private OperatorApiConnectionProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of OperatorApiConnectionInner class. + */ + public OperatorApiConnectionInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private OperatorApiConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public OperatorApiConnectionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public OperatorApiConnectionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the operatorApiPlanId property: Reference to the Operator API Plan Resource ID. + * + * @return the operatorApiPlanId value. + */ + public String operatorApiPlanId() { + return this.innerProperties() == null ? null : this.innerProperties().operatorApiPlanId(); + } + + /** + * Set the operatorApiPlanId property: Reference to the Operator API Plan Resource ID. + * + * @param operatorApiPlanId the operatorApiPlanId value to set. + * @return the OperatorApiConnectionInner object itself. + */ + public OperatorApiConnectionInner withOperatorApiPlanId(String operatorApiPlanId) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiConnectionProperties(); + } + this.innerProperties().withOperatorApiPlanId(operatorApiPlanId); + return this; + } + + /** + * Get the saasProperties property: Details about the SaaS offer purchased from the marketplace. + * + * @return the saasProperties value. + */ + public SaasProperties saasProperties() { + return this.innerProperties() == null ? null : this.innerProperties().saasProperties(); + } + + /** + * Set the saasProperties property: Details about the SaaS offer purchased from the marketplace. + * + * @param saasProperties the saasProperties value to set. + * @return the OperatorApiConnectionInner object itself. + */ + public OperatorApiConnectionInner withSaasProperties(SaasProperties saasProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiConnectionProperties(); + } + this.innerProperties().withSaasProperties(saasProperties); + return this; + } + + /** + * Get the configuredApplication property: Details about the Application that would use the Operator's Network APIs. + * + * @return the configuredApplication value. + */ + public ApplicationProperties configuredApplication() { + return this.innerProperties() == null ? null : this.innerProperties().configuredApplication(); + } + + /** + * Set the configuredApplication property: Details about the Application that would use the Operator's Network APIs. + * + * @param configuredApplication the configuredApplication value to set. + * @return the OperatorApiConnectionInner object itself. + */ + public OperatorApiConnectionInner withConfiguredApplication(ApplicationProperties configuredApplication) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiConnectionProperties(); + } + this.innerProperties().withConfiguredApplication(configuredApplication); + return this; + } + + /** + * Get the appId property: Application ID of the App Developer that is registered with the Operator in a specific + * country/region. + * + * @return the appId value. + */ + public String appId() { + return this.innerProperties() == null ? null : this.innerProperties().appId(); + } + + /** + * Set the appId property: Application ID of the App Developer that is registered with the Operator in a specific + * country/region. + * + * @param appId the appId value to set. + * @return the OperatorApiConnectionInner object itself. + */ + public OperatorApiConnectionInner withAppId(String appId) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiConnectionProperties(); + } + this.innerProperties().withAppId(appId); + return this; + } + + /** + * Get the gatewayId property: Reference to the APC Gateway resource ID. + * + * @return the gatewayId value. + */ + public String gatewayId() { + return this.innerProperties() == null ? null : this.innerProperties().gatewayId(); + } + + /** + * Set the gatewayId property: Reference to the APC Gateway resource ID. + * + * @param gatewayId the gatewayId value to set. + * @return the OperatorApiConnectionInner object itself. + */ + public OperatorApiConnectionInner withGatewayId(String gatewayId) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiConnectionProperties(); + } + this.innerProperties().withGatewayId(gatewayId); + return this; + } + + /** + * Get the accountType property: Type of the account the user has with the Operator's Network API infrastructure. + * AzureManaged | UserManaged. + * + * @return the accountType value. + */ + public AccountType accountType() { + return this.innerProperties() == null ? null : this.innerProperties().accountType(); + } + + /** + * Set the accountType property: Type of the account the user has with the Operator's Network API infrastructure. + * AzureManaged | UserManaged. + * + * @param accountType the accountType value to set. + * @return the OperatorApiConnectionInner object itself. + */ + public OperatorApiConnectionInner withAccountType(AccountType accountType) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiConnectionProperties(); + } + this.innerProperties().withAccountType(accountType); + return this; + } + + /** + * Get the appSecret property: Application secret linked to the 'appId'. This should be stored securely and is not + * returned back when the resource information is read. + * + * @return the appSecret value. + */ + public String appSecret() { + return this.innerProperties() == null ? null : this.innerProperties().appSecret(); + } + + /** + * Set the appSecret property: Application secret linked to the 'appId'. This should be stored securely and is not + * returned back when the resource information is read. + * + * @param appSecret the appSecret value to set. + * @return the OperatorApiConnectionInner object itself. + */ + public OperatorApiConnectionInner withAppSecret(String appSecret) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiConnectionProperties(); + } + this.innerProperties().withAppSecret(appSecret); + return this; + } + + /** + * Get the operatorName property: Name of the Operator in the linked Operator API Plan belongs to. + * + * @return the operatorName value. + */ + public String operatorName() { + return this.innerProperties() == null ? null : this.innerProperties().operatorName(); + } + + /** + * Get the camaraApiName property: The Network API for the current operator in the country/region provided in the + * linked Operator API Plan. + * + * @return the camaraApiName value. + */ + public String camaraApiName() { + return this.innerProperties() == null ? null : this.innerProperties().camaraApiName(); + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the status property: The status of the OperatorApiConnection resource. + * + * @return the status value. + */ + public Status status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (location() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property location in model OperatorApiConnectionInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperatorApiConnectionInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperatorApiConnectionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperatorApiConnectionInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperatorApiConnectionInner. + */ + public static OperatorApiConnectionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperatorApiConnectionInner deserializedOperatorApiConnectionInner = new OperatorApiConnectionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedOperatorApiConnectionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOperatorApiConnectionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedOperatorApiConnectionInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedOperatorApiConnectionInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedOperatorApiConnectionInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedOperatorApiConnectionInner.innerProperties + = OperatorApiConnectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedOperatorApiConnectionInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperatorApiConnectionInner; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiConnectionProperties.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiConnectionProperties.java new file mode 100644 index 000000000000..985381081a0d --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiConnectionProperties.java @@ -0,0 +1,370 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.models.AccountType; +import com.azure.resourcemanager.programmableconnectivity.models.ApplicationProperties; +import com.azure.resourcemanager.programmableconnectivity.models.ProvisioningState; +import com.azure.resourcemanager.programmableconnectivity.models.SaasProperties; +import com.azure.resourcemanager.programmableconnectivity.models.Status; +import java.io.IOException; + +/** + * Operator API Connection resource properties that cannot be updated once a resource has been created. + */ +@Fluent +public final class OperatorApiConnectionProperties implements JsonSerializable { + /* + * Reference to the Operator API Plan Resource ID. + */ + private String operatorApiPlanId; + + /* + * Details about the SaaS offer purchased from the marketplace. + */ + private SaasProperties saasProperties; + + /* + * Details about the Application that would use the Operator's Network APIs. + */ + private ApplicationProperties configuredApplication; + + /* + * Application ID of the App Developer that is registered with the Operator in a specific country/region. + */ + private String appId; + + /* + * Reference to the APC Gateway resource ID. + */ + private String gatewayId; + + /* + * Type of the account the user has with the Operator's Network API infrastructure. AzureManaged | UserManaged. + */ + private AccountType accountType; + + /* + * Application secret linked to the 'appId'. This should be stored securely and is not returned back when the + * resource information is read. + */ + private String appSecret; + + /* + * Name of the Operator in the linked Operator API Plan belongs to. + */ + private String operatorName; + + /* + * The Network API for the current operator in the country/region provided in the linked Operator API Plan. + */ + private String camaraApiName; + + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * The status of the OperatorApiConnection resource. + */ + private Status status; + + /** + * Creates an instance of OperatorApiConnectionProperties class. + */ + public OperatorApiConnectionProperties() { + } + + /** + * Get the operatorApiPlanId property: Reference to the Operator API Plan Resource ID. + * + * @return the operatorApiPlanId value. + */ + public String operatorApiPlanId() { + return this.operatorApiPlanId; + } + + /** + * Set the operatorApiPlanId property: Reference to the Operator API Plan Resource ID. + * + * @param operatorApiPlanId the operatorApiPlanId value to set. + * @return the OperatorApiConnectionProperties object itself. + */ + public OperatorApiConnectionProperties withOperatorApiPlanId(String operatorApiPlanId) { + this.operatorApiPlanId = operatorApiPlanId; + return this; + } + + /** + * Get the saasProperties property: Details about the SaaS offer purchased from the marketplace. + * + * @return the saasProperties value. + */ + public SaasProperties saasProperties() { + return this.saasProperties; + } + + /** + * Set the saasProperties property: Details about the SaaS offer purchased from the marketplace. + * + * @param saasProperties the saasProperties value to set. + * @return the OperatorApiConnectionProperties object itself. + */ + public OperatorApiConnectionProperties withSaasProperties(SaasProperties saasProperties) { + this.saasProperties = saasProperties; + return this; + } + + /** + * Get the configuredApplication property: Details about the Application that would use the Operator's Network APIs. + * + * @return the configuredApplication value. + */ + public ApplicationProperties configuredApplication() { + return this.configuredApplication; + } + + /** + * Set the configuredApplication property: Details about the Application that would use the Operator's Network APIs. + * + * @param configuredApplication the configuredApplication value to set. + * @return the OperatorApiConnectionProperties object itself. + */ + public OperatorApiConnectionProperties withConfiguredApplication(ApplicationProperties configuredApplication) { + this.configuredApplication = configuredApplication; + return this; + } + + /** + * Get the appId property: Application ID of the App Developer that is registered with the Operator in a specific + * country/region. + * + * @return the appId value. + */ + public String appId() { + return this.appId; + } + + /** + * Set the appId property: Application ID of the App Developer that is registered with the Operator in a specific + * country/region. + * + * @param appId the appId value to set. + * @return the OperatorApiConnectionProperties object itself. + */ + public OperatorApiConnectionProperties withAppId(String appId) { + this.appId = appId; + return this; + } + + /** + * Get the gatewayId property: Reference to the APC Gateway resource ID. + * + * @return the gatewayId value. + */ + public String gatewayId() { + return this.gatewayId; + } + + /** + * Set the gatewayId property: Reference to the APC Gateway resource ID. + * + * @param gatewayId the gatewayId value to set. + * @return the OperatorApiConnectionProperties object itself. + */ + public OperatorApiConnectionProperties withGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + return this; + } + + /** + * Get the accountType property: Type of the account the user has with the Operator's Network API infrastructure. + * AzureManaged | UserManaged. + * + * @return the accountType value. + */ + public AccountType accountType() { + return this.accountType; + } + + /** + * Set the accountType property: Type of the account the user has with the Operator's Network API infrastructure. + * AzureManaged | UserManaged. + * + * @param accountType the accountType value to set. + * @return the OperatorApiConnectionProperties object itself. + */ + public OperatorApiConnectionProperties withAccountType(AccountType accountType) { + this.accountType = accountType; + return this; + } + + /** + * Get the appSecret property: Application secret linked to the 'appId'. This should be stored securely and is not + * returned back when the resource information is read. + * + * @return the appSecret value. + */ + public String appSecret() { + return this.appSecret; + } + + /** + * Set the appSecret property: Application secret linked to the 'appId'. This should be stored securely and is not + * returned back when the resource information is read. + * + * @param appSecret the appSecret value to set. + * @return the OperatorApiConnectionProperties object itself. + */ + public OperatorApiConnectionProperties withAppSecret(String appSecret) { + this.appSecret = appSecret; + return this; + } + + /** + * Get the operatorName property: Name of the Operator in the linked Operator API Plan belongs to. + * + * @return the operatorName value. + */ + public String operatorName() { + return this.operatorName; + } + + /** + * Get the camaraApiName property: The Network API for the current operator in the country/region provided in the + * linked Operator API Plan. + * + * @return the camaraApiName value. + */ + public String camaraApiName() { + return this.camaraApiName; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the status property: The status of the OperatorApiConnection resource. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operatorApiPlanId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property operatorApiPlanId in model OperatorApiConnectionProperties")); + } + if (saasProperties() != null) { + saasProperties().validate(); + } + if (configuredApplication() != null) { + configuredApplication().validate(); + } + if (gatewayId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property gatewayId in model OperatorApiConnectionProperties")); + } + if (accountType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property accountType in model OperatorApiConnectionProperties")); + } + if (status() != null) { + status().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperatorApiConnectionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("operatorApiPlanId", this.operatorApiPlanId); + jsonWriter.writeStringField("gatewayId", this.gatewayId); + jsonWriter.writeStringField("accountType", this.accountType == null ? null : this.accountType.toString()); + jsonWriter.writeJsonField("saasProperties", this.saasProperties); + jsonWriter.writeJsonField("configuredApplication", this.configuredApplication); + jsonWriter.writeStringField("appId", this.appId); + jsonWriter.writeStringField("appSecret", this.appSecret); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperatorApiConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperatorApiConnectionProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperatorApiConnectionProperties. + */ + public static OperatorApiConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperatorApiConnectionProperties deserializedOperatorApiConnectionProperties + = new OperatorApiConnectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operatorApiPlanId".equals(fieldName)) { + deserializedOperatorApiConnectionProperties.operatorApiPlanId = reader.getString(); + } else if ("gatewayId".equals(fieldName)) { + deserializedOperatorApiConnectionProperties.gatewayId = reader.getString(); + } else if ("accountType".equals(fieldName)) { + deserializedOperatorApiConnectionProperties.accountType + = AccountType.fromString(reader.getString()); + } else if ("saasProperties".equals(fieldName)) { + deserializedOperatorApiConnectionProperties.saasProperties = SaasProperties.fromJson(reader); + } else if ("configuredApplication".equals(fieldName)) { + deserializedOperatorApiConnectionProperties.configuredApplication + = ApplicationProperties.fromJson(reader); + } else if ("appId".equals(fieldName)) { + deserializedOperatorApiConnectionProperties.appId = reader.getString(); + } else if ("appSecret".equals(fieldName)) { + deserializedOperatorApiConnectionProperties.appSecret = reader.getString(); + } else if ("operatorName".equals(fieldName)) { + deserializedOperatorApiConnectionProperties.operatorName = reader.getString(); + } else if ("camaraApiName".equals(fieldName)) { + deserializedOperatorApiConnectionProperties.camaraApiName = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedOperatorApiConnectionProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedOperatorApiConnectionProperties.status = Status.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperatorApiConnectionProperties; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiConnectionUpdateProperties.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiConnectionUpdateProperties.java new file mode 100644 index 000000000000..ba58a396c153 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiConnectionUpdateProperties.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.models.ApplicationProperties; +import com.azure.resourcemanager.programmableconnectivity.models.SaasProperties; +import java.io.IOException; + +/** + * The updatable properties of the OperatorApiConnection. + */ +@Fluent +public final class OperatorApiConnectionUpdateProperties + implements JsonSerializable { + /* + * Reference to the Operator API Plan Resource ID. + */ + private String operatorApiPlanId; + + /* + * Details about the SaaS offer purchased from the marketplace. + */ + private SaasProperties saasProperties; + + /* + * Details about the Application that would use the Operator's Network APIs. + */ + private ApplicationProperties configuredApplication; + + /* + * Application ID of the App Developer that is registered with the Operator in a specific country/region. + */ + private String appId; + + /* + * Application secret linked to the 'appId'. This should be stored securely and is not returned back when the + * resource information is read. + */ + private String appSecret; + + /** + * Creates an instance of OperatorApiConnectionUpdateProperties class. + */ + public OperatorApiConnectionUpdateProperties() { + } + + /** + * Get the operatorApiPlanId property: Reference to the Operator API Plan Resource ID. + * + * @return the operatorApiPlanId value. + */ + public String operatorApiPlanId() { + return this.operatorApiPlanId; + } + + /** + * Set the operatorApiPlanId property: Reference to the Operator API Plan Resource ID. + * + * @param operatorApiPlanId the operatorApiPlanId value to set. + * @return the OperatorApiConnectionUpdateProperties object itself. + */ + public OperatorApiConnectionUpdateProperties withOperatorApiPlanId(String operatorApiPlanId) { + this.operatorApiPlanId = operatorApiPlanId; + return this; + } + + /** + * Get the saasProperties property: Details about the SaaS offer purchased from the marketplace. + * + * @return the saasProperties value. + */ + public SaasProperties saasProperties() { + return this.saasProperties; + } + + /** + * Set the saasProperties property: Details about the SaaS offer purchased from the marketplace. + * + * @param saasProperties the saasProperties value to set. + * @return the OperatorApiConnectionUpdateProperties object itself. + */ + public OperatorApiConnectionUpdateProperties withSaasProperties(SaasProperties saasProperties) { + this.saasProperties = saasProperties; + return this; + } + + /** + * Get the configuredApplication property: Details about the Application that would use the Operator's Network APIs. + * + * @return the configuredApplication value. + */ + public ApplicationProperties configuredApplication() { + return this.configuredApplication; + } + + /** + * Set the configuredApplication property: Details about the Application that would use the Operator's Network APIs. + * + * @param configuredApplication the configuredApplication value to set. + * @return the OperatorApiConnectionUpdateProperties object itself. + */ + public OperatorApiConnectionUpdateProperties + withConfiguredApplication(ApplicationProperties configuredApplication) { + this.configuredApplication = configuredApplication; + return this; + } + + /** + * Get the appId property: Application ID of the App Developer that is registered with the Operator in a specific + * country/region. + * + * @return the appId value. + */ + public String appId() { + return this.appId; + } + + /** + * Set the appId property: Application ID of the App Developer that is registered with the Operator in a specific + * country/region. + * + * @param appId the appId value to set. + * @return the OperatorApiConnectionUpdateProperties object itself. + */ + public OperatorApiConnectionUpdateProperties withAppId(String appId) { + this.appId = appId; + return this; + } + + /** + * Get the appSecret property: Application secret linked to the 'appId'. This should be stored securely and is not + * returned back when the resource information is read. + * + * @return the appSecret value. + */ + public String appSecret() { + return this.appSecret; + } + + /** + * Set the appSecret property: Application secret linked to the 'appId'. This should be stored securely and is not + * returned back when the resource information is read. + * + * @param appSecret the appSecret value to set. + * @return the OperatorApiConnectionUpdateProperties object itself. + */ + public OperatorApiConnectionUpdateProperties withAppSecret(String appSecret) { + this.appSecret = appSecret; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (saasProperties() != null) { + saasProperties().validate(); + } + if (configuredApplication() != null) { + configuredApplication().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("operatorApiPlanId", this.operatorApiPlanId); + jsonWriter.writeJsonField("saasProperties", this.saasProperties); + jsonWriter.writeJsonField("configuredApplication", this.configuredApplication); + jsonWriter.writeStringField("appId", this.appId); + jsonWriter.writeStringField("appSecret", this.appSecret); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperatorApiConnectionUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperatorApiConnectionUpdateProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperatorApiConnectionUpdateProperties. + */ + public static OperatorApiConnectionUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperatorApiConnectionUpdateProperties deserializedOperatorApiConnectionUpdateProperties + = new OperatorApiConnectionUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operatorApiPlanId".equals(fieldName)) { + deserializedOperatorApiConnectionUpdateProperties.operatorApiPlanId = reader.getString(); + } else if ("saasProperties".equals(fieldName)) { + deserializedOperatorApiConnectionUpdateProperties.saasProperties = SaasProperties.fromJson(reader); + } else if ("configuredApplication".equals(fieldName)) { + deserializedOperatorApiConnectionUpdateProperties.configuredApplication + = ApplicationProperties.fromJson(reader); + } else if ("appId".equals(fieldName)) { + deserializedOperatorApiConnectionUpdateProperties.appId = reader.getString(); + } else if ("appSecret".equals(fieldName)) { + deserializedOperatorApiConnectionUpdateProperties.appSecret = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperatorApiConnectionUpdateProperties; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiPlanInner.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiPlanInner.java new file mode 100644 index 000000000000..e926ec8dc792 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiPlanInner.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.models.MarketplaceProperties; +import com.azure.resourcemanager.programmableconnectivity.models.ProvisioningState; +import java.io.IOException; +import java.util.List; + +/** + * A Programmable Connectivity Operator API Plans resource. This is a readonly resource that indicates which Operator + * Network APIs are available in the user's subscription. + */ +@Fluent +public final class OperatorApiPlanInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private OperatorApiPlanProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of OperatorApiPlanInner class. + */ + public OperatorApiPlanInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private OperatorApiPlanProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the operatorName property: Name of the Operator this plan belongs to. + * + * @return the operatorName value. + */ + public String operatorName() { + return this.innerProperties() == null ? null : this.innerProperties().operatorName(); + } + + /** + * Set the operatorName property: Name of the Operator this plan belongs to. + * + * @param operatorName the operatorName value to set. + * @return the OperatorApiPlanInner object itself. + */ + public OperatorApiPlanInner withOperatorName(String operatorName) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiPlanProperties(); + } + this.innerProperties().withOperatorName(operatorName); + return this; + } + + /** + * Get the camaraApiName property: Standardized Network API name defined by CAMARA specifications. + * + * @return the camaraApiName value. + */ + public String camaraApiName() { + return this.innerProperties() == null ? null : this.innerProperties().camaraApiName(); + } + + /** + * Set the camaraApiName property: Standardized Network API name defined by CAMARA specifications. + * + * @param camaraApiName the camaraApiName value to set. + * @return the OperatorApiPlanInner object itself. + */ + public OperatorApiPlanInner withCamaraApiName(String camaraApiName) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiPlanProperties(); + } + this.innerProperties().withCamaraApiName(camaraApiName); + return this; + } + + /** + * Get the supportedLocations property: List of Azure regions where this offer is supported. + * + * @return the supportedLocations value. + */ + public List supportedLocations() { + return this.innerProperties() == null ? null : this.innerProperties().supportedLocations(); + } + + /** + * Set the supportedLocations property: List of Azure regions where this offer is supported. + * + * @param supportedLocations the supportedLocations value to set. + * @return the OperatorApiPlanInner object itself. + */ + public OperatorApiPlanInner withSupportedLocations(List supportedLocations) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiPlanProperties(); + } + this.innerProperties().withSupportedLocations(supportedLocations); + return this; + } + + /** + * Get the operatorRegions property: List of country/region names where this plan is being supported by the + * Operator. + * + * @return the operatorRegions value. + */ + public List operatorRegions() { + return this.innerProperties() == null ? null : this.innerProperties().operatorRegions(); + } + + /** + * Set the operatorRegions property: List of country/region names where this plan is being supported by the + * Operator. + * + * @param operatorRegions the operatorRegions value to set. + * @return the OperatorApiPlanInner object itself. + */ + public OperatorApiPlanInner withOperatorRegions(List operatorRegions) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiPlanProperties(); + } + this.innerProperties().withOperatorRegions(operatorRegions); + return this; + } + + /** + * Get the markets property: List of country/region names where this plan is being supported by Azure Marketplace. + * + * @return the markets value. + */ + public List markets() { + return this.innerProperties() == null ? null : this.innerProperties().markets(); + } + + /** + * Set the markets property: List of country/region names where this plan is being supported by Azure Marketplace. + * + * @param markets the markets value to set. + * @return the OperatorApiPlanInner object itself. + */ + public OperatorApiPlanInner withMarkets(List markets) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiPlanProperties(); + } + this.innerProperties().withMarkets(markets); + return this; + } + + /** + * Get the limits property: The limits, if any, will be imposed by the operator. + * + * @return the limits value. + */ + public String limits() { + return this.innerProperties() == null ? null : this.innerProperties().limits(); + } + + /** + * Set the limits property: The limits, if any, will be imposed by the operator. + * + * @param limits the limits value to set. + * @return the OperatorApiPlanInner object itself. + */ + public OperatorApiPlanInner withLimits(String limits) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiPlanProperties(); + } + this.innerProperties().withLimits(limits); + return this; + } + + /** + * Get the marketplaceProperties property: Azure marketplace properties for this plan. + * + * @return the marketplaceProperties value. + */ + public MarketplaceProperties marketplaceProperties() { + return this.innerProperties() == null ? null : this.innerProperties().marketplaceProperties(); + } + + /** + * Set the marketplaceProperties property: Azure marketplace properties for this plan. + * + * @param marketplaceProperties the marketplaceProperties value to set. + * @return the OperatorApiPlanInner object itself. + */ + public OperatorApiPlanInner withMarketplaceProperties(MarketplaceProperties marketplaceProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiPlanProperties(); + } + this.innerProperties().withMarketplaceProperties(marketplaceProperties); + return this; + } + + /** + * Get the provisioningState property: The status of the last operation on the Gateway 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperatorApiPlanInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperatorApiPlanInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperatorApiPlanInner. + */ + public static OperatorApiPlanInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperatorApiPlanInner deserializedOperatorApiPlanInner = new OperatorApiPlanInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedOperatorApiPlanInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOperatorApiPlanInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedOperatorApiPlanInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedOperatorApiPlanInner.innerProperties = OperatorApiPlanProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedOperatorApiPlanInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperatorApiPlanInner; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiPlanProperties.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiPlanProperties.java new file mode 100644 index 000000000000..d886acca3c8f --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiPlanProperties.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.models.MarketplaceProperties; +import com.azure.resourcemanager.programmableconnectivity.models.ProvisioningState; +import java.io.IOException; +import java.util.List; + +/** + * Operator API Plan properties. + */ +@Fluent +public final class OperatorApiPlanProperties implements JsonSerializable { + /* + * Name of the Operator this plan belongs to. + */ + private String operatorName; + + /* + * Standardized Network API name defined by CAMARA specifications. + */ + private String camaraApiName; + + /* + * List of Azure regions where this offer is supported. + */ + private List supportedLocations; + + /* + * List of country/region names where this plan is being supported by the Operator. + */ + private List operatorRegions; + + /* + * List of country/region names where this plan is being supported by Azure Marketplace. + */ + private List markets; + + /* + * The limits, if any, will be imposed by the operator. + */ + private String limits; + + /* + * Azure marketplace properties for this plan. + */ + private MarketplaceProperties marketplaceProperties; + + /* + * The status of the last operation on the Gateway resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of OperatorApiPlanProperties class. + */ + public OperatorApiPlanProperties() { + } + + /** + * Get the operatorName property: Name of the Operator this plan belongs to. + * + * @return the operatorName value. + */ + public String operatorName() { + return this.operatorName; + } + + /** + * Set the operatorName property: Name of the Operator this plan belongs to. + * + * @param operatorName the operatorName value to set. + * @return the OperatorApiPlanProperties object itself. + */ + public OperatorApiPlanProperties withOperatorName(String operatorName) { + this.operatorName = operatorName; + return this; + } + + /** + * Get the camaraApiName property: Standardized Network API name defined by CAMARA specifications. + * + * @return the camaraApiName value. + */ + public String camaraApiName() { + return this.camaraApiName; + } + + /** + * Set the camaraApiName property: Standardized Network API name defined by CAMARA specifications. + * + * @param camaraApiName the camaraApiName value to set. + * @return the OperatorApiPlanProperties object itself. + */ + public OperatorApiPlanProperties withCamaraApiName(String camaraApiName) { + this.camaraApiName = camaraApiName; + return this; + } + + /** + * Get the supportedLocations property: List of Azure regions where this offer is supported. + * + * @return the supportedLocations value. + */ + public List supportedLocations() { + return this.supportedLocations; + } + + /** + * Set the supportedLocations property: List of Azure regions where this offer is supported. + * + * @param supportedLocations the supportedLocations value to set. + * @return the OperatorApiPlanProperties object itself. + */ + public OperatorApiPlanProperties withSupportedLocations(List supportedLocations) { + this.supportedLocations = supportedLocations; + return this; + } + + /** + * Get the operatorRegions property: List of country/region names where this plan is being supported by the + * Operator. + * + * @return the operatorRegions value. + */ + public List operatorRegions() { + return this.operatorRegions; + } + + /** + * Set the operatorRegions property: List of country/region names where this plan is being supported by the + * Operator. + * + * @param operatorRegions the operatorRegions value to set. + * @return the OperatorApiPlanProperties object itself. + */ + public OperatorApiPlanProperties withOperatorRegions(List operatorRegions) { + this.operatorRegions = operatorRegions; + return this; + } + + /** + * Get the markets property: List of country/region names where this plan is being supported by Azure Marketplace. + * + * @return the markets value. + */ + public List markets() { + return this.markets; + } + + /** + * Set the markets property: List of country/region names where this plan is being supported by Azure Marketplace. + * + * @param markets the markets value to set. + * @return the OperatorApiPlanProperties object itself. + */ + public OperatorApiPlanProperties withMarkets(List markets) { + this.markets = markets; + return this; + } + + /** + * Get the limits property: The limits, if any, will be imposed by the operator. + * + * @return the limits value. + */ + public String limits() { + return this.limits; + } + + /** + * Set the limits property: The limits, if any, will be imposed by the operator. + * + * @param limits the limits value to set. + * @return the OperatorApiPlanProperties object itself. + */ + public OperatorApiPlanProperties withLimits(String limits) { + this.limits = limits; + return this; + } + + /** + * Get the marketplaceProperties property: Azure marketplace properties for this plan. + * + * @return the marketplaceProperties value. + */ + public MarketplaceProperties marketplaceProperties() { + return this.marketplaceProperties; + } + + /** + * Set the marketplaceProperties property: Azure marketplace properties for this plan. + * + * @param marketplaceProperties the marketplaceProperties value to set. + * @return the OperatorApiPlanProperties object itself. + */ + public OperatorApiPlanProperties withMarketplaceProperties(MarketplaceProperties marketplaceProperties) { + this.marketplaceProperties = marketplaceProperties; + return this; + } + + /** + * Get the provisioningState property: The status of the last operation on the Gateway 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 (marketplaceProperties() != null) { + marketplaceProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("operatorName", this.operatorName); + jsonWriter.writeStringField("camaraApiName", this.camaraApiName); + jsonWriter.writeArrayField("supportedLocations", this.supportedLocations, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("operatorRegions", this.operatorRegions, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("markets", this.markets, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("limits", this.limits); + jsonWriter.writeJsonField("marketplaceProperties", this.marketplaceProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperatorApiPlanProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperatorApiPlanProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperatorApiPlanProperties. + */ + public static OperatorApiPlanProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperatorApiPlanProperties deserializedOperatorApiPlanProperties = new OperatorApiPlanProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operatorName".equals(fieldName)) { + deserializedOperatorApiPlanProperties.operatorName = reader.getString(); + } else if ("camaraApiName".equals(fieldName)) { + deserializedOperatorApiPlanProperties.camaraApiName = reader.getString(); + } else if ("supportedLocations".equals(fieldName)) { + List supportedLocations = reader.readArray(reader1 -> reader1.getString()); + deserializedOperatorApiPlanProperties.supportedLocations = supportedLocations; + } else if ("operatorRegions".equals(fieldName)) { + List operatorRegions = reader.readArray(reader1 -> reader1.getString()); + deserializedOperatorApiPlanProperties.operatorRegions = operatorRegions; + } else if ("markets".equals(fieldName)) { + List markets = reader.readArray(reader1 -> reader1.getString()); + deserializedOperatorApiPlanProperties.markets = markets; + } else if ("limits".equals(fieldName)) { + deserializedOperatorApiPlanProperties.limits = reader.getString(); + } else if ("marketplaceProperties".equals(fieldName)) { + deserializedOperatorApiPlanProperties.marketplaceProperties + = MarketplaceProperties.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedOperatorApiPlanProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperatorApiPlanProperties; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/package-info.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/package-info.java new file mode 100644 index 000000000000..58452b5adbba --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for ProgrammableConnectivity. + * Azure Programmable Connectivity Provider management API. + */ +package com.azure.resourcemanager.programmableconnectivity.fluent.models; diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/package-info.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/package-info.java new file mode 100644 index 000000000000..86538f69890a --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for ProgrammableConnectivity. + * Azure Programmable Connectivity Provider management API. + */ +package com.azure.resourcemanager.programmableconnectivity.fluent; diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/GatewayImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/GatewayImpl.java new file mode 100644 index 000000000000..6aef95730527 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/GatewayImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.GatewayInner; +import com.azure.resourcemanager.programmableconnectivity.models.Gateway; +import com.azure.resourcemanager.programmableconnectivity.models.GatewayTagsUpdate; +import com.azure.resourcemanager.programmableconnectivity.models.ProvisioningState; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class GatewayImpl implements Gateway, Gateway.Definition, Gateway.Update { + private GatewayInner innerObject; + + private final com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public List operatorApiConnections() { + List inner = this.innerModel().operatorApiConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String gatewayBaseUrl() { + return this.innerModel().gatewayBaseUrl(); + } + + 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 GatewayInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String gatewayName; + + private GatewayTagsUpdate updateProperties; + + public GatewayImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Gateway create() { + this.innerObject = serviceManager.serviceClient() + .getGateways() + .createOrUpdate(resourceGroupName, gatewayName, this.innerModel(), Context.NONE); + return this; + } + + public Gateway create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getGateways() + .createOrUpdate(resourceGroupName, gatewayName, this.innerModel(), context); + return this; + } + + GatewayImpl(String name, + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager) { + this.innerObject = new GatewayInner(); + this.serviceManager = serviceManager; + this.gatewayName = name; + } + + public GatewayImpl update() { + this.updateProperties = new GatewayTagsUpdate(); + return this; + } + + public Gateway apply() { + this.innerObject = serviceManager.serviceClient() + .getGateways() + .updateWithResponse(resourceGroupName, gatewayName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public Gateway apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getGateways() + .updateWithResponse(resourceGroupName, gatewayName, updateProperties, context) + .getValue(); + return this; + } + + GatewayImpl(GatewayInner innerObject, + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.gatewayName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "gateways"); + } + + public Gateway refresh() { + this.innerObject = serviceManager.serviceClient() + .getGateways() + .getByResourceGroupWithResponse(resourceGroupName, gatewayName, Context.NONE) + .getValue(); + return this; + } + + public Gateway refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getGateways() + .getByResourceGroupWithResponse(resourceGroupName, gatewayName, context) + .getValue(); + return this; + } + + public GatewayImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public GatewayImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public GatewayImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/GatewaysClientImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/GatewaysClientImpl.java new file mode 100644 index 000000000000..15cf649377bc --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/GatewaysClientImpl.java @@ -0,0 +1,1177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.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.programmableconnectivity.fluent.GatewaysClient; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.GatewayInner; +import com.azure.resourcemanager.programmableconnectivity.models.GatewayListResult; +import com.azure.resourcemanager.programmableconnectivity.models.GatewayTagsUpdate; +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 GatewaysClient. + */ +public final class GatewaysClientImpl implements GatewaysClient { + /** + * The proxy service used to perform REST calls. + */ + private final GatewaysService service; + + /** + * The service client containing this operation class. + */ + private final ProgrammableConnectivityImpl client; + + /** + * Initializes an instance of GatewaysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GatewaysClientImpl(ProgrammableConnectivityImpl client) { + this.service = RestProxy.create(GatewaysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ProgrammableConnectivityGateways to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ProgrammableConnecti") + public interface GatewaysService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ProgrammableConnectivity/gateways") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/gateways") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/gateways/{gatewayName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("gatewayName") String gatewayName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/gateways/{gatewayName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("gatewayName") String gatewayName, + @BodyParam("application/json") GatewayInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/gateways/{gatewayName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("gatewayName") String gatewayName, + @BodyParam("application/json") GatewayTagsUpdate properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/gateways/{gatewayName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("gatewayName") String gatewayName, + @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); + } + + /** + * List Gateway resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Gateway resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List Gateway resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Gateway resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List Gateway resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List Gateway resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List Gateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Gateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List Gateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List Gateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List Gateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List Gateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a Gateway resource by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Gateway resource by name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String gatewayName) { + 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 (gatewayName == null) { + return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, gatewayName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Gateway resource by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Gateway resource by name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String gatewayName, 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 (gatewayName == null) { + return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, gatewayName, accept, context); + } + + /** + * Get a Gateway resource by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Gateway resource by name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String gatewayName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, gatewayName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Gateway resource by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Gateway resource by name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String gatewayName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, gatewayName, context).block(); + } + + /** + * Get a Gateway resource by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Gateway resource by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GatewayInner getByResourceGroup(String resourceGroupName, String gatewayName) { + return getByResourceGroupWithResponse(resourceGroupName, gatewayName, Context.NONE).getValue(); + } + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String gatewayName, GatewayInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (gatewayName == null) { + return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, gatewayName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String gatewayName, GatewayInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (gatewayName == null) { + return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, gatewayName, resource, accept, context); + } + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Programmable Connectivity Gateway resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GatewayInner> beginCreateOrUpdateAsync(String resourceGroupName, + String gatewayName, GatewayInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, gatewayName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + GatewayInner.class, GatewayInner.class, this.client.getContext()); + } + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Programmable Connectivity Gateway resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GatewayInner> beginCreateOrUpdateAsync(String resourceGroupName, + String gatewayName, GatewayInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, gatewayName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + GatewayInner.class, GatewayInner.class, context); + } + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Programmable Connectivity Gateway resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GatewayInner> beginCreateOrUpdate(String resourceGroupName, + String gatewayName, GatewayInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, gatewayName, resource).getSyncPoller(); + } + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Programmable Connectivity Gateway resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GatewayInner> beginCreateOrUpdate(String resourceGroupName, + String gatewayName, GatewayInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, gatewayName, resource, context).getSyncPoller(); + } + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String gatewayName, + GatewayInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, gatewayName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String gatewayName, GatewayInner resource, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, gatewayName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GatewayInner createOrUpdate(String resourceGroupName, String gatewayName, GatewayInner resource) { + return createOrUpdateAsync(resourceGroupName, gatewayName, resource).block(); + } + + /** + * Create or update an APC Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GatewayInner createOrUpdate(String resourceGroupName, String gatewayName, GatewayInner resource, + Context context) { + return createOrUpdateAsync(resourceGroupName, gatewayName, resource, context).block(); + } + + /** + * Update Gateway tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String gatewayName, + GatewayTagsUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (gatewayName == null) { + return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, gatewayName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update Gateway tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String gatewayName, + GatewayTagsUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (gatewayName == null) { + return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, gatewayName, properties, accept, context); + } + + /** + * Update Gateway tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String gatewayName, GatewayTagsUpdate properties) { + return updateWithResponseAsync(resourceGroupName, gatewayName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update Gateway tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String gatewayName, + GatewayTagsUpdate properties, Context context) { + return updateWithResponseAsync(resourceGroupName, gatewayName, properties, context).block(); + } + + /** + * Update Gateway tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Gateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GatewayInner update(String resourceGroupName, String gatewayName, GatewayTagsUpdate properties) { + return updateWithResponse(resourceGroupName, gatewayName, properties, Context.NONE).getValue(); + } + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String gatewayName) { + 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 (gatewayName == null) { + return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, gatewayName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String gatewayName, + 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 (gatewayName == null) { + return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, gatewayName, accept, context); + } + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String gatewayName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, gatewayName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String gatewayName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, gatewayName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String gatewayName) { + return this.beginDeleteAsync(resourceGroupName, gatewayName).getSyncPoller(); + } + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String gatewayName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, gatewayName, context).getSyncPoller(); + } + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String gatewayName) { + return beginDeleteAsync(resourceGroupName, gatewayName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String gatewayName, Context context) { + return beginDeleteAsync(resourceGroupName, gatewayName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String gatewayName) { + deleteAsync(resourceGroupName, gatewayName).block(); + } + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String gatewayName, Context context) { + deleteAsync(resourceGroupName, gatewayName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/GatewaysImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/GatewaysImpl.java new file mode 100644 index 000000000000..61a079a6fd01 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/GatewaysImpl.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.programmableconnectivity.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.programmableconnectivity.fluent.GatewaysClient; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.GatewayInner; +import com.azure.resourcemanager.programmableconnectivity.models.Gateway; +import com.azure.resourcemanager.programmableconnectivity.models.Gateways; + +public final class GatewaysImpl implements Gateways { + private static final ClientLogger LOGGER = new ClientLogger(GatewaysImpl.class); + + private final GatewaysClient innerClient; + + private final com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager; + + public GatewaysImpl(GatewaysClient innerClient, + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GatewayImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GatewayImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GatewayImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GatewayImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String gatewayName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, gatewayName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GatewayImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Gateway getByResourceGroup(String resourceGroupName, String gatewayName) { + GatewayInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, gatewayName); + if (inner != null) { + return new GatewayImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String gatewayName) { + this.serviceClient().delete(resourceGroupName, gatewayName); + } + + public void delete(String resourceGroupName, String gatewayName, Context context) { + this.serviceClient().delete(resourceGroupName, gatewayName, context); + } + + public Gateway getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 gatewayName = ResourceManagerUtils.getValueFromIdByName(id, "gateways"); + if (gatewayName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'gateways'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, gatewayName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 gatewayName = ResourceManagerUtils.getValueFromIdByName(id, "gateways"); + if (gatewayName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'gateways'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, gatewayName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 gatewayName = ResourceManagerUtils.getValueFromIdByName(id, "gateways"); + if (gatewayName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'gateways'.", id))); + } + this.delete(resourceGroupName, gatewayName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 gatewayName = ResourceManagerUtils.getValueFromIdByName(id, "gateways"); + if (gatewayName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'gateways'.", id))); + } + this.delete(resourceGroupName, gatewayName, context); + } + + private GatewaysClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager() { + return this.serviceManager; + } + + public GatewayImpl define(String name) { + return new GatewayImpl(name, this.manager()); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperationImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperationImpl.java new file mode 100644 index 000000000000..951372263e67 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.implementation; + +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperationInner; +import com.azure.resourcemanager.programmableconnectivity.models.ActionType; +import com.azure.resourcemanager.programmableconnectivity.models.Operation; +import com.azure.resourcemanager.programmableconnectivity.models.OperationDisplay; +import com.azure.resourcemanager.programmableconnectivity.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager 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.programmableconnectivity.ProgrammableConnectivityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperationsClientImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..39312c40f8db --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.programmableconnectivity.fluent.OperationsClient; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperationInner; +import com.azure.resourcemanager.programmableconnectivity.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final ProgrammableConnectivityImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ProgrammableConnectivityImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ProgrammableConnectivityOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ProgrammableConnecti") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.ProgrammableConnectivity/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperationsImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperationsImpl.java new file mode 100644 index 000000000000..6409ab8cc850 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.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.programmableconnectivity.fluent.OperationsClient; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperationInner; +import com.azure.resourcemanager.programmableconnectivity.models.Operation; +import com.azure.resourcemanager.programmableconnectivity.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiConnectionImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiConnectionImpl.java new file mode 100644 index 000000000000..8b2501ec2f19 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiConnectionImpl.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiConnectionInner; +import com.azure.resourcemanager.programmableconnectivity.models.AccountType; +import com.azure.resourcemanager.programmableconnectivity.models.ApplicationProperties; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnection; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnectionUpdate; +import com.azure.resourcemanager.programmableconnectivity.models.ProvisioningState; +import com.azure.resourcemanager.programmableconnectivity.models.SaasProperties; +import com.azure.resourcemanager.programmableconnectivity.models.Status; +import java.util.Collections; +import java.util.Map; + +public final class OperatorApiConnectionImpl + implements OperatorApiConnection, OperatorApiConnection.Definition, OperatorApiConnection.Update { + private OperatorApiConnectionInner innerObject; + + private final com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String operatorApiPlanId() { + return this.innerModel().operatorApiPlanId(); + } + + public SaasProperties saasProperties() { + return this.innerModel().saasProperties(); + } + + public ApplicationProperties configuredApplication() { + return this.innerModel().configuredApplication(); + } + + public String appId() { + return this.innerModel().appId(); + } + + public String gatewayId() { + return this.innerModel().gatewayId(); + } + + public AccountType accountType() { + return this.innerModel().accountType(); + } + + public String appSecret() { + return this.innerModel().appSecret(); + } + + public String operatorName() { + return this.innerModel().operatorName(); + } + + public String camaraApiName() { + return this.innerModel().camaraApiName(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Status status() { + return this.innerModel().status(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public OperatorApiConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String operatorApiConnectionName; + + private OperatorApiConnectionUpdate updateProperties; + + public OperatorApiConnectionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public OperatorApiConnection create() { + this.innerObject = serviceManager.serviceClient() + .getOperatorApiConnections() + .create(resourceGroupName, operatorApiConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public OperatorApiConnection create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getOperatorApiConnections() + .create(resourceGroupName, operatorApiConnectionName, this.innerModel(), context); + return this; + } + + OperatorApiConnectionImpl(String name, + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager) { + this.innerObject = new OperatorApiConnectionInner(); + this.serviceManager = serviceManager; + this.operatorApiConnectionName = name; + } + + public OperatorApiConnectionImpl update() { + this.updateProperties = new OperatorApiConnectionUpdate(); + return this; + } + + public OperatorApiConnection apply() { + this.innerObject = serviceManager.serviceClient() + .getOperatorApiConnections() + .update(resourceGroupName, operatorApiConnectionName, updateProperties, Context.NONE); + return this; + } + + public OperatorApiConnection apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getOperatorApiConnections() + .update(resourceGroupName, operatorApiConnectionName, updateProperties, context); + return this; + } + + OperatorApiConnectionImpl(OperatorApiConnectionInner innerObject, + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.operatorApiConnectionName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "operatorApiConnections"); + } + + public OperatorApiConnection refresh() { + this.innerObject = serviceManager.serviceClient() + .getOperatorApiConnections() + .getByResourceGroupWithResponse(resourceGroupName, operatorApiConnectionName, Context.NONE) + .getValue(); + return this; + } + + public OperatorApiConnection refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getOperatorApiConnections() + .getByResourceGroupWithResponse(resourceGroupName, operatorApiConnectionName, context) + .getValue(); + return this; + } + + public OperatorApiConnectionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public OperatorApiConnectionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public OperatorApiConnectionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public OperatorApiConnectionImpl withOperatorApiPlanId(String operatorApiPlanId) { + if (isInCreateMode()) { + this.innerModel().withOperatorApiPlanId(operatorApiPlanId); + return this; + } else { + this.updateProperties.withOperatorApiPlanId(operatorApiPlanId); + return this; + } + } + + public OperatorApiConnectionImpl withSaasProperties(SaasProperties saasProperties) { + if (isInCreateMode()) { + this.innerModel().withSaasProperties(saasProperties); + return this; + } else { + this.updateProperties.withSaasProperties(saasProperties); + return this; + } + } + + public OperatorApiConnectionImpl withConfiguredApplication(ApplicationProperties configuredApplication) { + if (isInCreateMode()) { + this.innerModel().withConfiguredApplication(configuredApplication); + return this; + } else { + this.updateProperties.withConfiguredApplication(configuredApplication); + return this; + } + } + + public OperatorApiConnectionImpl withAppId(String appId) { + if (isInCreateMode()) { + this.innerModel().withAppId(appId); + return this; + } else { + this.updateProperties.withAppId(appId); + return this; + } + } + + public OperatorApiConnectionImpl withGatewayId(String gatewayId) { + this.innerModel().withGatewayId(gatewayId); + return this; + } + + public OperatorApiConnectionImpl withAccountType(AccountType accountType) { + this.innerModel().withAccountType(accountType); + return this; + } + + public OperatorApiConnectionImpl withAppSecret(String appSecret) { + if (isInCreateMode()) { + this.innerModel().withAppSecret(appSecret); + return this; + } else { + this.updateProperties.withAppSecret(appSecret); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiConnectionsClientImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiConnectionsClientImpl.java new file mode 100644 index 000000000000..0013d4b81f00 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiConnectionsClientImpl.java @@ -0,0 +1,1301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.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.programmableconnectivity.fluent.OperatorApiConnectionsClient; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiConnectionInner; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnectionListResult; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnectionUpdate; +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 OperatorApiConnectionsClient. + */ +public final class OperatorApiConnectionsClientImpl implements OperatorApiConnectionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperatorApiConnectionsService service; + + /** + * The service client containing this operation class. + */ + private final ProgrammableConnectivityImpl client; + + /** + * Initializes an instance of OperatorApiConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperatorApiConnectionsClientImpl(ProgrammableConnectivityImpl client) { + this.service = RestProxy.create(OperatorApiConnectionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ProgrammableConnectivityOperatorApiConnections to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ProgrammableConnecti") + public interface OperatorApiConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections/{operatorApiConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("operatorApiConnectionName") String operatorApiConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections/{operatorApiConnectionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("operatorApiConnectionName") String operatorApiConnectionName, + @BodyParam("application/json") OperatorApiConnectionInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections/{operatorApiConnectionName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("operatorApiConnectionName") String operatorApiConnectionName, + @BodyParam("application/json") OperatorApiConnectionUpdate properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections/{operatorApiConnectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("operatorApiConnectionName") String operatorApiConnectionName, + @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); + } + + /** + * List OperatorApiConnection resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List OperatorApiConnection resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List OperatorApiConnection resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List OperatorApiConnection resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List OperatorApiConnection resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List OperatorApiConnection resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List OperatorApiConnection resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List OperatorApiConnection resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List OperatorApiConnection resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List OperatorApiConnection resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List OperatorApiConnection resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List OperatorApiConnection resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Operator API Connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String operatorApiConnectionName) { + 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 (operatorApiConnectionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter operatorApiConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, operatorApiConnectionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Operator API Connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String operatorApiConnectionName, 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 (operatorApiConnectionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter operatorApiConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, operatorApiConnectionName, accept, context); + } + + /** + * Get an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Operator API Connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String operatorApiConnectionName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, operatorApiConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Operator API Connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String operatorApiConnectionName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, operatorApiConnectionName, context).block(); + } + + /** + * Get an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Operator API Connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperatorApiConnectionInner getByResourceGroup(String resourceGroupName, String operatorApiConnectionName) { + return getByResourceGroupWithResponse(resourceGroupName, operatorApiConnectionName, Context.NONE).getValue(); + } + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String operatorApiConnectionName, OperatorApiConnectionInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (operatorApiConnectionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter operatorApiConnectionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, operatorApiConnectionName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String operatorApiConnectionName, OperatorApiConnectionInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (operatorApiConnectionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter operatorApiConnectionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, operatorApiConnectionName, resource, accept, context); + } + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OperatorApiConnectionInner> beginCreateAsync( + String resourceGroupName, String operatorApiConnectionName, OperatorApiConnectionInner resource) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, operatorApiConnectionName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), OperatorApiConnectionInner.class, OperatorApiConnectionInner.class, + this.client.getContext()); + } + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OperatorApiConnectionInner> beginCreateAsync( + String resourceGroupName, String operatorApiConnectionName, OperatorApiConnectionInner resource, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createWithResponseAsync(resourceGroupName, operatorApiConnectionName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), OperatorApiConnectionInner.class, OperatorApiConnectionInner.class, context); + } + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OperatorApiConnectionInner> + beginCreate(String resourceGroupName, String operatorApiConnectionName, OperatorApiConnectionInner resource) { + return this.beginCreateAsync(resourceGroupName, operatorApiConnectionName, resource).getSyncPoller(); + } + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OperatorApiConnectionInner> beginCreate( + String resourceGroupName, String operatorApiConnectionName, OperatorApiConnectionInner resource, + Context context) { + return this.beginCreateAsync(resourceGroupName, operatorApiConnectionName, resource, context).getSyncPoller(); + } + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String operatorApiConnectionName, + OperatorApiConnectionInner resource) { + return beginCreateAsync(resourceGroupName, operatorApiConnectionName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String operatorApiConnectionName, + OperatorApiConnectionInner resource, Context context) { + return beginCreateAsync(resourceGroupName, operatorApiConnectionName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperatorApiConnectionInner create(String resourceGroupName, String operatorApiConnectionName, + OperatorApiConnectionInner resource) { + return createAsync(resourceGroupName, operatorApiConnectionName, resource).block(); + } + + /** + * Create an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperatorApiConnectionInner create(String resourceGroupName, String operatorApiConnectionName, + OperatorApiConnectionInner resource, Context context) { + return createAsync(resourceGroupName, operatorApiConnectionName, resource, context).block(); + } + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String operatorApiConnectionName, OperatorApiConnectionUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (operatorApiConnectionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter operatorApiConnectionName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, operatorApiConnectionName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String operatorApiConnectionName, OperatorApiConnectionUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (operatorApiConnectionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter operatorApiConnectionName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, operatorApiConnectionName, properties, accept, context); + } + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OperatorApiConnectionInner> beginUpdateAsync( + String resourceGroupName, String operatorApiConnectionName, OperatorApiConnectionUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, operatorApiConnectionName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), OperatorApiConnectionInner.class, OperatorApiConnectionInner.class, + this.client.getContext()); + } + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OperatorApiConnectionInner> beginUpdateAsync( + String resourceGroupName, String operatorApiConnectionName, OperatorApiConnectionUpdate properties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, operatorApiConnectionName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), OperatorApiConnectionInner.class, OperatorApiConnectionInner.class, context); + } + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OperatorApiConnectionInner> beginUpdate( + String resourceGroupName, String operatorApiConnectionName, OperatorApiConnectionUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, operatorApiConnectionName, properties).getSyncPoller(); + } + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OperatorApiConnectionInner> beginUpdate( + String resourceGroupName, String operatorApiConnectionName, OperatorApiConnectionUpdate properties, + Context context) { + return this.beginUpdateAsync(resourceGroupName, operatorApiConnectionName, properties, context).getSyncPoller(); + } + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String operatorApiConnectionName, + OperatorApiConnectionUpdate properties) { + return beginUpdateAsync(resourceGroupName, operatorApiConnectionName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String operatorApiConnectionName, + OperatorApiConnectionUpdate properties, Context context) { + return beginUpdateAsync(resourceGroupName, operatorApiConnectionName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperatorApiConnectionInner update(String resourceGroupName, String operatorApiConnectionName, + OperatorApiConnectionUpdate properties) { + return updateAsync(resourceGroupName, operatorApiConnectionName, properties).block(); + } + + /** + * Update an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Programmable Connectivity Operator API Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperatorApiConnectionInner update(String resourceGroupName, String operatorApiConnectionName, + OperatorApiConnectionUpdate properties, Context context) { + return updateAsync(resourceGroupName, operatorApiConnectionName, properties, context).block(); + } + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String operatorApiConnectionName) { + 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 (operatorApiConnectionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter operatorApiConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, operatorApiConnectionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String operatorApiConnectionName, 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 (operatorApiConnectionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter operatorApiConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, operatorApiConnectionName, accept, context); + } + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String operatorApiConnectionName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, operatorApiConnectionName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String operatorApiConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, operatorApiConnectionName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String operatorApiConnectionName) { + return this.beginDeleteAsync(resourceGroupName, operatorApiConnectionName).getSyncPoller(); + } + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String operatorApiConnectionName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, operatorApiConnectionName, context).getSyncPoller(); + } + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String operatorApiConnectionName) { + return beginDeleteAsync(resourceGroupName, operatorApiConnectionName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String operatorApiConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, operatorApiConnectionName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String operatorApiConnectionName) { + deleteAsync(resourceGroupName, operatorApiConnectionName).block(); + } + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String operatorApiConnectionName, Context context) { + deleteAsync(resourceGroupName, operatorApiConnectionName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiConnectionsImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiConnectionsImpl.java new file mode 100644 index 000000000000..2b456cd51df6 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiConnectionsImpl.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.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.programmableconnectivity.fluent.OperatorApiConnectionsClient; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiConnectionInner; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnection; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnections; + +public final class OperatorApiConnectionsImpl implements OperatorApiConnections { + private static final ClientLogger LOGGER = new ClientLogger(OperatorApiConnectionsImpl.class); + + private final OperatorApiConnectionsClient innerClient; + + private final com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager; + + public OperatorApiConnectionsImpl(OperatorApiConnectionsClient innerClient, + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperatorApiConnectionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperatorApiConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperatorApiConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperatorApiConnectionImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String operatorApiConnectionName, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, operatorApiConnectionName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new OperatorApiConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OperatorApiConnection getByResourceGroup(String resourceGroupName, String operatorApiConnectionName) { + OperatorApiConnectionInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, operatorApiConnectionName); + if (inner != null) { + return new OperatorApiConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String operatorApiConnectionName) { + this.serviceClient().delete(resourceGroupName, operatorApiConnectionName); + } + + public void delete(String resourceGroupName, String operatorApiConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, operatorApiConnectionName, context); + } + + public OperatorApiConnection getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 operatorApiConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "operatorApiConnections"); + if (operatorApiConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'operatorApiConnections'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, operatorApiConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 operatorApiConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "operatorApiConnections"); + if (operatorApiConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'operatorApiConnections'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, operatorApiConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 operatorApiConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "operatorApiConnections"); + if (operatorApiConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'operatorApiConnections'.", id))); + } + this.delete(resourceGroupName, operatorApiConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 operatorApiConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "operatorApiConnections"); + if (operatorApiConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'operatorApiConnections'.", id))); + } + this.delete(resourceGroupName, operatorApiConnectionName, context); + } + + private OperatorApiConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager() { + return this.serviceManager; + } + + public OperatorApiConnectionImpl define(String name) { + return new OperatorApiConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiPlanImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiPlanImpl.java new file mode 100644 index 000000000000..42b60bd38fbd --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiPlanImpl.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiPlanInner; +import com.azure.resourcemanager.programmableconnectivity.models.MarketplaceProperties; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiPlan; +import com.azure.resourcemanager.programmableconnectivity.models.ProvisioningState; +import java.util.Collections; +import java.util.List; + +public final class OperatorApiPlanImpl implements OperatorApiPlan { + private OperatorApiPlanInner innerObject; + + private final com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager; + + OperatorApiPlanImpl(OperatorApiPlanInner innerObject, + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String operatorName() { + return this.innerModel().operatorName(); + } + + public String camaraApiName() { + return this.innerModel().camaraApiName(); + } + + public List supportedLocations() { + List inner = this.innerModel().supportedLocations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List operatorRegions() { + List inner = this.innerModel().operatorRegions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List markets() { + List inner = this.innerModel().markets(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String limits() { + return this.innerModel().limits(); + } + + public MarketplaceProperties marketplaceProperties() { + return this.innerModel().marketplaceProperties(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public OperatorApiPlanInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiPlansClientImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiPlansClientImpl.java new file mode 100644 index 000000000000..016b76c7ae9b --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiPlansClientImpl.java @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.programmableconnectivity.fluent.OperatorApiPlansClient; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiPlanInner; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiPlanListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperatorApiPlansClient. + */ +public final class OperatorApiPlansClientImpl implements OperatorApiPlansClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperatorApiPlansService service; + + /** + * The service client containing this operation class. + */ + private final ProgrammableConnectivityImpl client; + + /** + * Initializes an instance of OperatorApiPlansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperatorApiPlansClientImpl(ProgrammableConnectivityImpl client) { + this.service + = RestProxy.create(OperatorApiPlansService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ProgrammableConnectivityOperatorApiPlans to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ProgrammableConnecti") + public interface OperatorApiPlansService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$filter") String filter, @QueryParam("$top") Integer top, @QueryParam("$skip") Integer skip, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans/{operatorApiPlanName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("operatorApiPlanName") String operatorApiPlanName, @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); + } + + /** + * List OperatorApiPlan resources by subscription ID. + * + * @param filter An optional OData based filter expression to apply on the operation. + * @param top An optional query parameter which specifies the maximum number of records to be returned. + * @param skip An optional query parameter which specifies the number of records to be skipped. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiPlan list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, Integer top, Integer skip) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), filter, top, skip, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List OperatorApiPlan resources by subscription ID. + * + * @param filter An optional OData based filter expression to apply on the operation. + * @param top An optional query parameter which specifies the maximum number of records to be returned. + * @param skip An optional query parameter which specifies the number of records to be skipped. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiPlan list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, Integer top, Integer skip, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), filter, top, + skip, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List OperatorApiPlan resources by subscription ID. + * + * @param filter An optional OData based filter expression to apply on the operation. + * @param top An optional query parameter which specifies the maximum number of records to be returned. + * @param skip An optional query parameter which specifies the number of records to be skipped. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiPlan list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Integer top, Integer skip) { + return new PagedFlux<>(() -> listSinglePageAsync(filter, top, skip), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List OperatorApiPlan resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiPlan list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + final Integer top = null; + final Integer skip = null; + return new PagedFlux<>(() -> listSinglePageAsync(filter, top, skip), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List OperatorApiPlan resources by subscription ID. + * + * @param filter An optional OData based filter expression to apply on the operation. + * @param top An optional query parameter which specifies the maximum number of records to be returned. + * @param skip An optional query parameter which specifies the number of records to be skipped. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiPlan list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Integer top, Integer skip, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(filter, top, skip, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List OperatorApiPlan resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiPlan list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + final Integer top = null; + final Integer skip = null; + return new PagedIterable<>(listAsync(filter, top, skip)); + } + + /** + * List OperatorApiPlan resources by subscription ID. + * + * @param filter An optional OData based filter expression to apply on the operation. + * @param top An optional query parameter which specifies the maximum number of records to be returned. + * @param skip An optional query parameter which specifies the number of records to be skipped. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiPlan list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Integer top, Integer skip, Context context) { + return new PagedIterable<>(listAsync(filter, top, skip, context)); + } + + /** + * Get an OperatorApiPlan resource by name. + * + * @param operatorApiPlanName APC Gateway Plan Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an OperatorApiPlan resource by name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String operatorApiPlanName) { + 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 (operatorApiPlanName == null) { + return Mono + .error(new IllegalArgumentException("Parameter operatorApiPlanName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), operatorApiPlanName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get an OperatorApiPlan resource by name. + * + * @param operatorApiPlanName APC Gateway Plan Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an OperatorApiPlan resource by name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String operatorApiPlanName, 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 (operatorApiPlanName == null) { + return Mono + .error(new IllegalArgumentException("Parameter operatorApiPlanName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + operatorApiPlanName, accept, context); + } + + /** + * Get an OperatorApiPlan resource by name. + * + * @param operatorApiPlanName APC Gateway Plan Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an OperatorApiPlan resource by name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String operatorApiPlanName) { + return getWithResponseAsync(operatorApiPlanName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get an OperatorApiPlan resource by name. + * + * @param operatorApiPlanName APC Gateway Plan Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an OperatorApiPlan resource by name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String operatorApiPlanName, Context context) { + return getWithResponseAsync(operatorApiPlanName, context).block(); + } + + /** + * Get an OperatorApiPlan resource by name. + * + * @param operatorApiPlanName APC Gateway Plan Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an OperatorApiPlan resource by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperatorApiPlanInner get(String operatorApiPlanName) { + return getWithResponse(operatorApiPlanName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiPlan list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiPlan list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiPlansImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiPlansImpl.java new file mode 100644 index 000000000000..4e1d095ff675 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiPlansImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.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.programmableconnectivity.fluent.OperatorApiPlansClient; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiPlanInner; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiPlan; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiPlans; + +public final class OperatorApiPlansImpl implements OperatorApiPlans { + private static final ClientLogger LOGGER = new ClientLogger(OperatorApiPlansImpl.class); + + private final OperatorApiPlansClient innerClient; + + private final com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager; + + public OperatorApiPlansImpl(OperatorApiPlansClient innerClient, + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperatorApiPlanImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Integer top, Integer skip, Context context) { + PagedIterable inner = this.serviceClient().list(filter, top, skip, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperatorApiPlanImpl(inner1, this.manager())); + } + + public Response getWithResponse(String operatorApiPlanName, Context context) { + Response inner = this.serviceClient().getWithResponse(operatorApiPlanName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new OperatorApiPlanImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OperatorApiPlan get(String operatorApiPlanName) { + OperatorApiPlanInner inner = this.serviceClient().get(operatorApiPlanName); + if (inner != null) { + return new OperatorApiPlanImpl(inner, this.manager()); + } else { + return null; + } + } + + private OperatorApiPlansClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ProgrammableConnectivityBuilder.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ProgrammableConnectivityBuilder.java new file mode 100644 index 000000000000..5dd4c7add482 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ProgrammableConnectivityBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.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 ProgrammableConnectivityImpl type. + */ +@ServiceClientBuilder(serviceClients = { ProgrammableConnectivityImpl.class }) +public final class ProgrammableConnectivityBuilder { + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the ProgrammableConnectivityBuilder. + */ + public ProgrammableConnectivityBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ProgrammableConnectivityBuilder. + */ + public ProgrammableConnectivityBuilder 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 ProgrammableConnectivityBuilder. + */ + public ProgrammableConnectivityBuilder 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 ProgrammableConnectivityBuilder. + */ + public ProgrammableConnectivityBuilder 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 ProgrammableConnectivityBuilder. + */ + public ProgrammableConnectivityBuilder 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 ProgrammableConnectivityBuilder. + */ + public ProgrammableConnectivityBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ProgrammableConnectivityImpl with the provided parameters. + * + * @return an instance of ProgrammableConnectivityImpl. + */ + public ProgrammableConnectivityImpl 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(); + ProgrammableConnectivityImpl client = new ProgrammableConnectivityImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ProgrammableConnectivityImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ProgrammableConnectivityImpl.java new file mode 100644 index 000000000000..43bced784264 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ProgrammableConnectivityImpl.java @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +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.PollerFactory; +import com.azure.core.management.polling.PollResult; +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.programmableconnectivity.fluent.GatewaysClient; +import com.azure.resourcemanager.programmableconnectivity.fluent.OperationsClient; +import com.azure.resourcemanager.programmableconnectivity.fluent.OperatorApiConnectionsClient; +import com.azure.resourcemanager.programmableconnectivity.fluent.OperatorApiPlansClient; +import com.azure.resourcemanager.programmableconnectivity.fluent.ProgrammableConnectivity; +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 ProgrammableConnectivityImpl type. + */ +@ServiceClient(builder = ProgrammableConnectivityBuilder.class) +public final class ProgrammableConnectivityImpl implements ProgrammableConnectivity { + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * server parameter. + */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Api Version. + */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The GatewaysClient object to access its operations. + */ + private final GatewaysClient gateways; + + /** + * Gets the GatewaysClient object to access its operations. + * + * @return the GatewaysClient object. + */ + public GatewaysClient getGateways() { + return this.gateways; + } + + /** + * The OperatorApiConnectionsClient object to access its operations. + */ + private final OperatorApiConnectionsClient operatorApiConnections; + + /** + * Gets the OperatorApiConnectionsClient object to access its operations. + * + * @return the OperatorApiConnectionsClient object. + */ + public OperatorApiConnectionsClient getOperatorApiConnections() { + return this.operatorApiConnections; + } + + /** + * The OperatorApiPlansClient object to access its operations. + */ + private final OperatorApiPlansClient operatorApiPlans; + + /** + * Gets the OperatorApiPlansClient object to access its operations. + * + * @return the OperatorApiPlansClient object. + */ + public OperatorApiPlansClient getOperatorApiPlans() { + return this.operatorApiPlans; + } + + /** + * Initializes an instance of ProgrammableConnectivity 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. The value must be an UUID. + * @param endpoint server parameter. + */ + ProgrammableConnectivityImpl(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 = "2024-01-15-preview"; + this.operations = new OperationsClientImpl(this); + this.gateways = new GatewaysClientImpl(this); + this.operatorApiConnections = new OperatorApiConnectionsClientImpl(this); + this.operatorApiPlans = new OperatorApiPlansClientImpl(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(HttpHeaderName.fromString(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(ProgrammableConnectivityImpl.class); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ResourceManagerUtils.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..0ed23efb0940 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.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 ResourceManagerUtils { + private ResourceManagerUtils() { + } + + 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.isEmpty() && 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<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(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/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/package-info.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/package-info.java new file mode 100644 index 000000000000..67fd439bf436 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for ProgrammableConnectivity. + * Azure Programmable Connectivity Provider management API. + */ +package com.azure.resourcemanager.programmableconnectivity.implementation; diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/AccountType.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/AccountType.java new file mode 100644 index 000000000000..a01d10cf51ec --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/AccountType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Account Type of the Operator API Connections. + */ +public final class AccountType extends ExpandableStringEnum { + /** + * Static value AzureManaged for AccountType. + */ + public static final AccountType AZURE_MANAGED = fromString("AzureManaged"); + + /** + * Static value UserManaged for AccountType. + */ + public static final AccountType USER_MANAGED = fromString("UserManaged"); + + /** + * Creates a new instance of AccountType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AccountType() { + } + + /** + * Creates or finds a AccountType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccountType. + */ + public static AccountType fromString(String name) { + return fromString(name, AccountType.class); + } + + /** + * Gets known AccountType values. + * + * @return known AccountType values. + */ + public static Collection values() { + return values(AccountType.class); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ActionType.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ActionType.java new file mode 100644 index 000000000000..230e4e33aa02 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +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. + */ + 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/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ApplicationProperties.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ApplicationProperties.java new file mode 100644 index 000000000000..df2548a13709 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ApplicationProperties.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Details about the Application that would use the Operator's Network APIs. + */ +@Fluent +public final class ApplicationProperties implements JsonSerializable { + /* + * Name of the application. Example: Contoso App. + */ + private String name; + + /* + * Description of the application. + */ + private String applicationDescription; + + /* + * The category that describes the application. + */ + private String applicationType; + + /* + * Legal name of the organization owning the application. + */ + private String legalName; + + /* + * A description of the organization owning the application. + */ + private String organizationDescription; + + /* + * Unique Tax Number for the user's organization in the country/region the APC Gateway is being purchased. + */ + private String taxNumber; + + /* + * Email address of the Privacy contact or Data Protection officer of the organization. + */ + private String privacyContactEmailAddress; + + /** + * Creates an instance of ApplicationProperties class. + */ + public ApplicationProperties() { + } + + /** + * Get the name property: Name of the application. Example: Contoso App. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the application. Example: Contoso App. + * + * @param name the name value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the applicationDescription property: Description of the application. + * + * @return the applicationDescription value. + */ + public String applicationDescription() { + return this.applicationDescription; + } + + /** + * Set the applicationDescription property: Description of the application. + * + * @param applicationDescription the applicationDescription value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withApplicationDescription(String applicationDescription) { + this.applicationDescription = applicationDescription; + return this; + } + + /** + * Get the applicationType property: The category that describes the application. + * + * @return the applicationType value. + */ + public String applicationType() { + return this.applicationType; + } + + /** + * Set the applicationType property: The category that describes the application. + * + * @param applicationType the applicationType value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withApplicationType(String applicationType) { + this.applicationType = applicationType; + return this; + } + + /** + * Get the legalName property: Legal name of the organization owning the application. + * + * @return the legalName value. + */ + public String legalName() { + return this.legalName; + } + + /** + * Set the legalName property: Legal name of the organization owning the application. + * + * @param legalName the legalName value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withLegalName(String legalName) { + this.legalName = legalName; + return this; + } + + /** + * Get the organizationDescription property: A description of the organization owning the application. + * + * @return the organizationDescription value. + */ + public String organizationDescription() { + return this.organizationDescription; + } + + /** + * Set the organizationDescription property: A description of the organization owning the application. + * + * @param organizationDescription the organizationDescription value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withOrganizationDescription(String organizationDescription) { + this.organizationDescription = organizationDescription; + return this; + } + + /** + * Get the taxNumber property: Unique Tax Number for the user's organization in the country/region the APC Gateway + * is being purchased. + * + * @return the taxNumber value. + */ + public String taxNumber() { + return this.taxNumber; + } + + /** + * Set the taxNumber property: Unique Tax Number for the user's organization in the country/region the APC Gateway + * is being purchased. + * + * @param taxNumber the taxNumber value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withTaxNumber(String taxNumber) { + this.taxNumber = taxNumber; + return this; + } + + /** + * Get the privacyContactEmailAddress property: Email address of the Privacy contact or Data Protection officer of + * the organization. + * + * @return the privacyContactEmailAddress value. + */ + public String privacyContactEmailAddress() { + return this.privacyContactEmailAddress; + } + + /** + * Set the privacyContactEmailAddress property: Email address of the Privacy contact or Data Protection officer of + * the organization. + * + * @param privacyContactEmailAddress the privacyContactEmailAddress value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withPrivacyContactEmailAddress(String privacyContactEmailAddress) { + this.privacyContactEmailAddress = privacyContactEmailAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("applicationDescription", this.applicationDescription); + jsonWriter.writeStringField("applicationType", this.applicationType); + jsonWriter.writeStringField("legalName", this.legalName); + jsonWriter.writeStringField("organizationDescription", this.organizationDescription); + jsonWriter.writeStringField("taxNumber", this.taxNumber); + jsonWriter.writeStringField("privacyContactEmailAddress", this.privacyContactEmailAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApplicationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApplicationProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ApplicationProperties. + */ + public static ApplicationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApplicationProperties deserializedApplicationProperties = new ApplicationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedApplicationProperties.name = reader.getString(); + } else if ("applicationDescription".equals(fieldName)) { + deserializedApplicationProperties.applicationDescription = reader.getString(); + } else if ("applicationType".equals(fieldName)) { + deserializedApplicationProperties.applicationType = reader.getString(); + } else if ("legalName".equals(fieldName)) { + deserializedApplicationProperties.legalName = reader.getString(); + } else if ("organizationDescription".equals(fieldName)) { + deserializedApplicationProperties.organizationDescription = reader.getString(); + } else if ("taxNumber".equals(fieldName)) { + deserializedApplicationProperties.taxNumber = reader.getString(); + } else if ("privacyContactEmailAddress".equals(fieldName)) { + deserializedApplicationProperties.privacyContactEmailAddress = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedApplicationProperties; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Gateway.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Gateway.java new file mode 100644 index 000000000000..824535ff1b86 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Gateway.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.GatewayInner; +import java.util.List; +import java.util.Map; + +/** + * An immutable client-side representation of Gateway. + */ +public interface Gateway { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the operatorApiConnections property: List of Operator API Connections selected by the user. + * + * @return the operatorApiConnections value. + */ + List operatorApiConnections(); + + /** + * Gets the gatewayBaseUrl property: Base URL of the Gateway resource. This is the URL that the users would use to + * make Open API Gateway requests to the Operators via Azure. + * + * @return the gatewayBaseUrl value. + */ + String gatewayBaseUrl(); + + /** + * Gets the provisioningState property: The status of the last operation on the Gateway 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.programmableconnectivity.fluent.models.GatewayInner object. + * + * @return the inner object. + */ + GatewayInner innerModel(); + + /** + * The entirety of the Gateway definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The Gateway definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Gateway definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Gateway 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 Gateway 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 Gateway 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + Gateway create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Gateway create(Context context); + } + + /** + * The stage of the Gateway 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); + } + } + + /** + * Begins update for the Gateway resource. + * + * @return the stage of resource update. + */ + Gateway.Update update(); + + /** + * The template for Gateway update. + */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Gateway apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Gateway apply(Context context); + } + + /** + * The Gateway update stages. + */ + interface UpdateStages { + /** + * The stage of the Gateway 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. + */ + Gateway refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Gateway refresh(Context context); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/GatewayListResult.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/GatewayListResult.java new file mode 100644 index 000000000000..4321c4d4d357 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/GatewayListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.GatewayInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Gateway list operation. + */ +@Fluent +public final class GatewayListResult implements JsonSerializable { + /* + * The Gateway items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of GatewayListResult class. + */ + public GatewayListResult() { + } + + /** + * Get the value property: The Gateway items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Gateway items on this page. + * + * @param value the value value to set. + * @return the GatewayListResult object itself. + */ + public GatewayListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the GatewayListResult object itself. + */ + public GatewayListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model GatewayListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GatewayListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GatewayListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GatewayListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GatewayListResult. + */ + public static GatewayListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GatewayListResult deserializedGatewayListResult = new GatewayListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> GatewayInner.fromJson(reader1)); + deserializedGatewayListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedGatewayListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGatewayListResult; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/GatewayTagsUpdate.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/GatewayTagsUpdate.java new file mode 100644 index 000000000000..1947e1a759fc --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/GatewayTagsUpdate.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for updating tags in Gateway resources. + */ +@Fluent +public final class GatewayTagsUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of GatewayTagsUpdate class. + */ + public GatewayTagsUpdate() { + } + + /** + * 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 GatewayTagsUpdate object itself. + */ + public GatewayTagsUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GatewayTagsUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GatewayTagsUpdate if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the GatewayTagsUpdate. + */ + public static GatewayTagsUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GatewayTagsUpdate deserializedGatewayTagsUpdate = new GatewayTagsUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedGatewayTagsUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedGatewayTagsUpdate; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Gateways.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Gateways.java new file mode 100644 index 000000000000..11890c096382 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Gateways.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.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 Gateways. + */ +public interface Gateways { + /** + * List Gateway resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List Gateway resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List Gateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Gateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Gateway list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a Gateway resource by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Gateway resource by name along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String gatewayName, Context context); + + /** + * Get a Gateway resource by name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Gateway resource by name. + */ + Gateway getByResourceGroup(String resourceGroupName, String gatewayName); + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String gatewayName); + + /** + * Delete a Gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param gatewayName Azure Programmable Connectivity Gateway Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String gatewayName, Context context); + + /** + * Get a Gateway resource by name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Gateway resource by name along with {@link Response}. + */ + Gateway getById(String id); + + /** + * Get a Gateway resource by name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Gateway resource by name along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Gateway. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Gateway. + * + * @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 Gateway resource. + * + * @param name resource name. + * @return the first stage of the new Gateway definition. + */ + Gateway.DefinitionStages.Blank define(String name); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/MarketplaceProperties.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/MarketplaceProperties.java new file mode 100644 index 000000000000..bc903e9fe69e --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/MarketplaceProperties.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Azure marketplace properties for a plan. + */ +@Fluent +public final class MarketplaceProperties implements JsonSerializable { + /* + * Azure marketplace Offer ID for this plan. + */ + private String offerId; + + /* + * Azure marketplace Legacy Offer ID for this plan. This is used to fetch the details of the plan from the Azure + * marketplace. + */ + private String legacyOfferId; + + /* + * Azure marketplace Publisher ID for this plan. + */ + private String publisherId; + + /* + * Azure marketplace Plan ID for this plan. + */ + private String planId; + + /* + * Azure marketplace Term ID for this plan. + */ + private String termId; + + /** + * Creates an instance of MarketplaceProperties class. + */ + public MarketplaceProperties() { + } + + /** + * Get the offerId property: Azure marketplace Offer ID for this plan. + * + * @return the offerId value. + */ + public String offerId() { + return this.offerId; + } + + /** + * Set the offerId property: Azure marketplace Offer ID for this plan. + * + * @param offerId the offerId value to set. + * @return the MarketplaceProperties object itself. + */ + public MarketplaceProperties withOfferId(String offerId) { + this.offerId = offerId; + return this; + } + + /** + * Get the legacyOfferId property: Azure marketplace Legacy Offer ID for this plan. This is used to fetch the + * details of the plan from the Azure marketplace. + * + * @return the legacyOfferId value. + */ + public String legacyOfferId() { + return this.legacyOfferId; + } + + /** + * Set the legacyOfferId property: Azure marketplace Legacy Offer ID for this plan. This is used to fetch the + * details of the plan from the Azure marketplace. + * + * @param legacyOfferId the legacyOfferId value to set. + * @return the MarketplaceProperties object itself. + */ + public MarketplaceProperties withLegacyOfferId(String legacyOfferId) { + this.legacyOfferId = legacyOfferId; + return this; + } + + /** + * Get the publisherId property: Azure marketplace Publisher ID for this plan. + * + * @return the publisherId value. + */ + public String publisherId() { + return this.publisherId; + } + + /** + * Set the publisherId property: Azure marketplace Publisher ID for this plan. + * + * @param publisherId the publisherId value to set. + * @return the MarketplaceProperties object itself. + */ + public MarketplaceProperties withPublisherId(String publisherId) { + this.publisherId = publisherId; + return this; + } + + /** + * Get the planId property: Azure marketplace Plan ID for this plan. + * + * @return the planId value. + */ + public String planId() { + return this.planId; + } + + /** + * Set the planId property: Azure marketplace Plan ID for this plan. + * + * @param planId the planId value to set. + * @return the MarketplaceProperties object itself. + */ + public MarketplaceProperties withPlanId(String planId) { + this.planId = planId; + return this; + } + + /** + * Get the termId property: Azure marketplace Term ID for this plan. + * + * @return the termId value. + */ + public String termId() { + return this.termId; + } + + /** + * Set the termId property: Azure marketplace Term ID for this plan. + * + * @param termId the termId value to set. + * @return the MarketplaceProperties object itself. + */ + public MarketplaceProperties withTermId(String termId) { + this.termId = termId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offerId", this.offerId); + jsonWriter.writeStringField("legacyOfferId", this.legacyOfferId); + jsonWriter.writeStringField("publisherId", this.publisherId); + jsonWriter.writeStringField("planId", this.planId); + jsonWriter.writeStringField("termId", this.termId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MarketplaceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MarketplaceProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the MarketplaceProperties. + */ + public static MarketplaceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MarketplaceProperties deserializedMarketplaceProperties = new MarketplaceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("offerId".equals(fieldName)) { + deserializedMarketplaceProperties.offerId = reader.getString(); + } else if ("legacyOfferId".equals(fieldName)) { + deserializedMarketplaceProperties.legacyOfferId = reader.getString(); + } else if ("publisherId".equals(fieldName)) { + deserializedMarketplaceProperties.publisherId = reader.getString(); + } else if ("planId".equals(fieldName)) { + deserializedMarketplaceProperties.planId = reader.getString(); + } else if ("termId".equals(fieldName)) { + deserializedMarketplaceProperties.termId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMarketplaceProperties; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Operation.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Operation.java new file mode 100644 index 000000000000..7bf9b100735b --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.resourcemanager.programmableconnectivity.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.programmableconnectivity.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperationDisplay.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperationDisplay.java new file mode 100644 index 000000000000..079d860042ab --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperationListResult.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperationListResult.java new file mode 100644 index 000000000000..dee06b78b1bc --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperationListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperationInner; +import java.io.IOException; +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 implements JsonSerializable { + /* + * List of operations supported by the resource provider + */ + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Operations.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Operations.java new file mode 100644 index 000000000000..cafb1a92a4a6 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnection.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnection.java new file mode 100644 index 000000000000..743124acc9d9 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnection.java @@ -0,0 +1,486 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiConnectionInner; +import java.util.Map; + +/** + * An immutable client-side representation of OperatorApiConnection. + */ +public interface OperatorApiConnection { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the operatorApiPlanId property: Reference to the Operator API Plan Resource ID. + * + * @return the operatorApiPlanId value. + */ + String operatorApiPlanId(); + + /** + * Gets the saasProperties property: Details about the SaaS offer purchased from the marketplace. + * + * @return the saasProperties value. + */ + SaasProperties saasProperties(); + + /** + * Gets the configuredApplication property: Details about the Application that would use the Operator's Network + * APIs. + * + * @return the configuredApplication value. + */ + ApplicationProperties configuredApplication(); + + /** + * Gets the appId property: Application ID of the App Developer that is registered with the Operator in a specific + * country/region. + * + * @return the appId value. + */ + String appId(); + + /** + * Gets the gatewayId property: Reference to the APC Gateway resource ID. + * + * @return the gatewayId value. + */ + String gatewayId(); + + /** + * Gets the accountType property: Type of the account the user has with the Operator's Network API infrastructure. + * AzureManaged | UserManaged. + * + * @return the accountType value. + */ + AccountType accountType(); + + /** + * Gets the appSecret property: Application secret linked to the 'appId'. This should be stored securely and is not + * returned back when the resource information is read. + * + * @return the appSecret value. + */ + String appSecret(); + + /** + * Gets the operatorName property: Name of the Operator in the linked Operator API Plan belongs to. + * + * @return the operatorName value. + */ + String operatorName(); + + /** + * Gets the camaraApiName property: The Network API for the current operator in the country/region provided in the + * linked Operator API Plan. + * + * @return the camaraApiName value. + */ + String camaraApiName(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the status property: The status of the OperatorApiConnection resource. + * + * @return the status value. + */ + Status status(); + + /** + * 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.programmableconnectivity.fluent.models.OperatorApiConnectionInner + * object. + * + * @return the inner object. + */ + OperatorApiConnectionInner innerModel(); + + /** + * The entirety of the OperatorApiConnection definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The OperatorApiConnection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the OperatorApiConnection definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the OperatorApiConnection 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 OperatorApiConnection 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 OperatorApiConnection 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.WithOperatorApiPlanId, + DefinitionStages.WithSaasProperties, DefinitionStages.WithConfiguredApplication, DefinitionStages.WithAppId, + DefinitionStages.WithGatewayId, DefinitionStages.WithAccountType, DefinitionStages.WithAppSecret { + /** + * Executes the create request. + * + * @return the created resource. + */ + OperatorApiConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + OperatorApiConnection create(Context context); + } + + /** + * The stage of the OperatorApiConnection 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 OperatorApiConnection definition allowing to specify operatorApiPlanId. + */ + interface WithOperatorApiPlanId { + /** + * Specifies the operatorApiPlanId property: Reference to the Operator API Plan Resource ID.. + * + * @param operatorApiPlanId Reference to the Operator API Plan Resource ID. + * @return the next definition stage. + */ + WithCreate withOperatorApiPlanId(String operatorApiPlanId); + } + + /** + * The stage of the OperatorApiConnection definition allowing to specify saasProperties. + */ + interface WithSaasProperties { + /** + * Specifies the saasProperties property: Details about the SaaS offer purchased from the marketplace.. + * + * @param saasProperties Details about the SaaS offer purchased from the marketplace. + * @return the next definition stage. + */ + WithCreate withSaasProperties(SaasProperties saasProperties); + } + + /** + * The stage of the OperatorApiConnection definition allowing to specify configuredApplication. + */ + interface WithConfiguredApplication { + /** + * Specifies the configuredApplication property: Details about the Application that would use the Operator's + * Network APIs.. + * + * @param configuredApplication Details about the Application that would use the Operator's Network APIs. + * @return the next definition stage. + */ + WithCreate withConfiguredApplication(ApplicationProperties configuredApplication); + } + + /** + * The stage of the OperatorApiConnection definition allowing to specify appId. + */ + interface WithAppId { + /** + * Specifies the appId property: Application ID of the App Developer that is registered with the Operator in + * a specific country/region.. + * + * @param appId Application ID of the App Developer that is registered with the Operator in a specific + * country/region. + * @return the next definition stage. + */ + WithCreate withAppId(String appId); + } + + /** + * The stage of the OperatorApiConnection definition allowing to specify gatewayId. + */ + interface WithGatewayId { + /** + * Specifies the gatewayId property: Reference to the APC Gateway resource ID.. + * + * @param gatewayId Reference to the APC Gateway resource ID. + * @return the next definition stage. + */ + WithCreate withGatewayId(String gatewayId); + } + + /** + * The stage of the OperatorApiConnection definition allowing to specify accountType. + */ + interface WithAccountType { + /** + * Specifies the accountType property: Type of the account the user has with the Operator's Network API + * infrastructure. AzureManaged | UserManaged.. + * + * @param accountType Type of the account the user has with the Operator's Network API infrastructure. + * AzureManaged | UserManaged. + * @return the next definition stage. + */ + WithCreate withAccountType(AccountType accountType); + } + + /** + * The stage of the OperatorApiConnection definition allowing to specify appSecret. + */ + interface WithAppSecret { + /** + * Specifies the appSecret property: Application secret linked to the 'appId'. This should be stored + * securely and is not returned back when the resource information is read.. + * + * @param appSecret Application secret linked to the 'appId'. This should be stored securely and is not + * returned back when the resource information is read. + * @return the next definition stage. + */ + WithCreate withAppSecret(String appSecret); + } + } + + /** + * Begins update for the OperatorApiConnection resource. + * + * @return the stage of resource update. + */ + OperatorApiConnection.Update update(); + + /** + * The template for OperatorApiConnection update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithOperatorApiPlanId, UpdateStages.WithSaasProperties, + UpdateStages.WithConfiguredApplication, UpdateStages.WithAppId, UpdateStages.WithAppSecret { + /** + * Executes the update request. + * + * @return the updated resource. + */ + OperatorApiConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + OperatorApiConnection apply(Context context); + } + + /** + * The OperatorApiConnection update stages. + */ + interface UpdateStages { + /** + * The stage of the OperatorApiConnection update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the OperatorApiConnection update allowing to specify operatorApiPlanId. + */ + interface WithOperatorApiPlanId { + /** + * Specifies the operatorApiPlanId property: Reference to the Operator API Plan Resource ID.. + * + * @param operatorApiPlanId Reference to the Operator API Plan Resource ID. + * @return the next definition stage. + */ + Update withOperatorApiPlanId(String operatorApiPlanId); + } + + /** + * The stage of the OperatorApiConnection update allowing to specify saasProperties. + */ + interface WithSaasProperties { + /** + * Specifies the saasProperties property: Details about the SaaS offer purchased from the marketplace.. + * + * @param saasProperties Details about the SaaS offer purchased from the marketplace. + * @return the next definition stage. + */ + Update withSaasProperties(SaasProperties saasProperties); + } + + /** + * The stage of the OperatorApiConnection update allowing to specify configuredApplication. + */ + interface WithConfiguredApplication { + /** + * Specifies the configuredApplication property: Details about the Application that would use the Operator's + * Network APIs.. + * + * @param configuredApplication Details about the Application that would use the Operator's Network APIs. + * @return the next definition stage. + */ + Update withConfiguredApplication(ApplicationProperties configuredApplication); + } + + /** + * The stage of the OperatorApiConnection update allowing to specify appId. + */ + interface WithAppId { + /** + * Specifies the appId property: Application ID of the App Developer that is registered with the Operator in + * a specific country/region.. + * + * @param appId Application ID of the App Developer that is registered with the Operator in a specific + * country/region. + * @return the next definition stage. + */ + Update withAppId(String appId); + } + + /** + * The stage of the OperatorApiConnection update allowing to specify appSecret. + */ + interface WithAppSecret { + /** + * Specifies the appSecret property: Application secret linked to the 'appId'. This should be stored + * securely and is not returned back when the resource information is read.. + * + * @param appSecret Application secret linked to the 'appId'. This should be stored securely and is not + * returned back when the resource information is read. + * @return the next definition stage. + */ + Update withAppSecret(String appSecret); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + OperatorApiConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + OperatorApiConnection refresh(Context context); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnectionListResult.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnectionListResult.java new file mode 100644 index 000000000000..4e15fe6c1d4d --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnectionListResult.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiConnectionInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a OperatorApiConnection list operation. + */ +@Fluent +public final class OperatorApiConnectionListResult implements JsonSerializable { + /* + * The OperatorApiConnection items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperatorApiConnectionListResult class. + */ + public OperatorApiConnectionListResult() { + } + + /** + * Get the value property: The OperatorApiConnection items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The OperatorApiConnection items on this page. + * + * @param value the value value to set. + * @return the OperatorApiConnectionListResult object itself. + */ + public OperatorApiConnectionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the OperatorApiConnectionListResult object itself. + */ + public OperatorApiConnectionListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model OperatorApiConnectionListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperatorApiConnectionListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperatorApiConnectionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperatorApiConnectionListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperatorApiConnectionListResult. + */ + public static OperatorApiConnectionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperatorApiConnectionListResult deserializedOperatorApiConnectionListResult + = new OperatorApiConnectionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> OperatorApiConnectionInner.fromJson(reader1)); + deserializedOperatorApiConnectionListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperatorApiConnectionListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperatorApiConnectionListResult; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnectionUpdate.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnectionUpdate.java new file mode 100644 index 000000000000..df230fca1911 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnectionUpdate.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiConnectionUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for update operations of the OperatorApiConnection. + */ +@Fluent +public final class OperatorApiConnectionUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * The resource-specific properties for this resource. + */ + private OperatorApiConnectionUpdateProperties innerProperties; + + /** + * Creates an instance of OperatorApiConnectionUpdate class. + */ + public OperatorApiConnectionUpdate() { + } + + /** + * 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 OperatorApiConnectionUpdate object itself. + */ + public OperatorApiConnectionUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private OperatorApiConnectionUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the operatorApiPlanId property: Reference to the Operator API Plan Resource ID. + * + * @return the operatorApiPlanId value. + */ + public String operatorApiPlanId() { + return this.innerProperties() == null ? null : this.innerProperties().operatorApiPlanId(); + } + + /** + * Set the operatorApiPlanId property: Reference to the Operator API Plan Resource ID. + * + * @param operatorApiPlanId the operatorApiPlanId value to set. + * @return the OperatorApiConnectionUpdate object itself. + */ + public OperatorApiConnectionUpdate withOperatorApiPlanId(String operatorApiPlanId) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiConnectionUpdateProperties(); + } + this.innerProperties().withOperatorApiPlanId(operatorApiPlanId); + return this; + } + + /** + * Get the saasProperties property: Details about the SaaS offer purchased from the marketplace. + * + * @return the saasProperties value. + */ + public SaasProperties saasProperties() { + return this.innerProperties() == null ? null : this.innerProperties().saasProperties(); + } + + /** + * Set the saasProperties property: Details about the SaaS offer purchased from the marketplace. + * + * @param saasProperties the saasProperties value to set. + * @return the OperatorApiConnectionUpdate object itself. + */ + public OperatorApiConnectionUpdate withSaasProperties(SaasProperties saasProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiConnectionUpdateProperties(); + } + this.innerProperties().withSaasProperties(saasProperties); + return this; + } + + /** + * Get the configuredApplication property: Details about the Application that would use the Operator's Network APIs. + * + * @return the configuredApplication value. + */ + public ApplicationProperties configuredApplication() { + return this.innerProperties() == null ? null : this.innerProperties().configuredApplication(); + } + + /** + * Set the configuredApplication property: Details about the Application that would use the Operator's Network APIs. + * + * @param configuredApplication the configuredApplication value to set. + * @return the OperatorApiConnectionUpdate object itself. + */ + public OperatorApiConnectionUpdate withConfiguredApplication(ApplicationProperties configuredApplication) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiConnectionUpdateProperties(); + } + this.innerProperties().withConfiguredApplication(configuredApplication); + return this; + } + + /** + * Get the appId property: Application ID of the App Developer that is registered with the Operator in a specific + * country/region. + * + * @return the appId value. + */ + public String appId() { + return this.innerProperties() == null ? null : this.innerProperties().appId(); + } + + /** + * Set the appId property: Application ID of the App Developer that is registered with the Operator in a specific + * country/region. + * + * @param appId the appId value to set. + * @return the OperatorApiConnectionUpdate object itself. + */ + public OperatorApiConnectionUpdate withAppId(String appId) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiConnectionUpdateProperties(); + } + this.innerProperties().withAppId(appId); + return this; + } + + /** + * Get the appSecret property: Application secret linked to the 'appId'. This should be stored securely and is not + * returned back when the resource information is read. + * + * @return the appSecret value. + */ + public String appSecret() { + return this.innerProperties() == null ? null : this.innerProperties().appSecret(); + } + + /** + * Set the appSecret property: Application secret linked to the 'appId'. This should be stored securely and is not + * returned back when the resource information is read. + * + * @param appSecret the appSecret value to set. + * @return the OperatorApiConnectionUpdate object itself. + */ + public OperatorApiConnectionUpdate withAppSecret(String appSecret) { + if (this.innerProperties() == null) { + this.innerProperties = new OperatorApiConnectionUpdateProperties(); + } + this.innerProperties().withAppSecret(appSecret); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperatorApiConnectionUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperatorApiConnectionUpdate if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperatorApiConnectionUpdate. + */ + public static OperatorApiConnectionUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperatorApiConnectionUpdate deserializedOperatorApiConnectionUpdate = new OperatorApiConnectionUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedOperatorApiConnectionUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedOperatorApiConnectionUpdate.innerProperties + = OperatorApiConnectionUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperatorApiConnectionUpdate; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnections.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnections.java new file mode 100644 index 000000000000..db0b5d83e242 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnections.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.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 OperatorApiConnections. + */ +public interface OperatorApiConnections { + /** + * List OperatorApiConnection resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List OperatorApiConnection resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List OperatorApiConnection resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List OperatorApiConnection resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiConnection list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Operator API Connection along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String operatorApiConnectionName, Context context); + + /** + * Get an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Operator API Connection. + */ + OperatorApiConnection getByResourceGroup(String resourceGroupName, String operatorApiConnectionName); + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String operatorApiConnectionName); + + /** + * Delete an Operator API Connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param operatorApiConnectionName Azure Programmable Connectivity (APC) Operator API Connection Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String operatorApiConnectionName, Context context); + + /** + * Get an Operator API Connection. + * + * @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 an Operator API Connection along with {@link Response}. + */ + OperatorApiConnection getById(String id); + + /** + * Get an Operator API Connection. + * + * @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 an Operator API Connection along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an Operator API Connection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete an Operator API Connection. + * + * @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 OperatorApiConnection resource. + * + * @param name resource name. + * @return the first stage of the new OperatorApiConnection definition. + */ + OperatorApiConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiPlan.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiPlan.java new file mode 100644 index 000000000000..02284ec84caa --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiPlan.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiPlanInner; +import java.util.List; + +/** + * An immutable client-side representation of OperatorApiPlan. + */ +public interface OperatorApiPlan { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the operatorName property: Name of the Operator this plan belongs to. + * + * @return the operatorName value. + */ + String operatorName(); + + /** + * Gets the camaraApiName property: Standardized Network API name defined by CAMARA specifications. + * + * @return the camaraApiName value. + */ + String camaraApiName(); + + /** + * Gets the supportedLocations property: List of Azure regions where this offer is supported. + * + * @return the supportedLocations value. + */ + List supportedLocations(); + + /** + * Gets the operatorRegions property: List of country/region names where this plan is being supported by the + * Operator. + * + * @return the operatorRegions value. + */ + List operatorRegions(); + + /** + * Gets the markets property: List of country/region names where this plan is being supported by Azure Marketplace. + * + * @return the markets value. + */ + List markets(); + + /** + * Gets the limits property: The limits, if any, will be imposed by the operator. + * + * @return the limits value. + */ + String limits(); + + /** + * Gets the marketplaceProperties property: Azure marketplace properties for this plan. + * + * @return the marketplaceProperties value. + */ + MarketplaceProperties marketplaceProperties(); + + /** + * Gets the provisioningState property: The status of the last operation on the Gateway resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiPlanInner object. + * + * @return the inner object. + */ + OperatorApiPlanInner innerModel(); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiPlanListResult.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiPlanListResult.java new file mode 100644 index 000000000000..c1c193ea6345 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiPlanListResult.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiPlanInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a OperatorApiPlan list operation. + */ +@Fluent +public final class OperatorApiPlanListResult implements JsonSerializable { + /* + * The OperatorApiPlan items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperatorApiPlanListResult class. + */ + public OperatorApiPlanListResult() { + } + + /** + * Get the value property: The OperatorApiPlan items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The OperatorApiPlan items on this page. + * + * @param value the value value to set. + * @return the OperatorApiPlanListResult object itself. + */ + public OperatorApiPlanListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the OperatorApiPlanListResult object itself. + */ + public OperatorApiPlanListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property value in model OperatorApiPlanListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperatorApiPlanListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperatorApiPlanListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperatorApiPlanListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperatorApiPlanListResult. + */ + public static OperatorApiPlanListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperatorApiPlanListResult deserializedOperatorApiPlanListResult = new OperatorApiPlanListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> OperatorApiPlanInner.fromJson(reader1)); + deserializedOperatorApiPlanListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperatorApiPlanListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperatorApiPlanListResult; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiPlans.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiPlans.java new file mode 100644 index 000000000000..fd02097bd966 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiPlans.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.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 OperatorApiPlans. + */ +public interface OperatorApiPlans { + /** + * List OperatorApiPlan resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiPlan list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List OperatorApiPlan resources by subscription ID. + * + * @param filter An optional OData based filter expression to apply on the operation. + * @param top An optional query parameter which specifies the maximum number of records to be returned. + * @param skip An optional query parameter which specifies the number of records to be skipped. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a OperatorApiPlan list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String filter, Integer top, Integer skip, Context context); + + /** + * Get an OperatorApiPlan resource by name. + * + * @param operatorApiPlanName APC Gateway Plan Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an OperatorApiPlan resource by name along with {@link Response}. + */ + Response getWithResponse(String operatorApiPlanName, Context context); + + /** + * Get an OperatorApiPlan resource by name. + * + * @param operatorApiPlanName APC Gateway Plan Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an OperatorApiPlan resource by name. + */ + OperatorApiPlan get(String operatorApiPlanName); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Origin.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Origin.java new file mode 100644 index 000000000000..37b49e01f0f0 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +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. + */ + 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/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ProvisioningState.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ProvisioningState.java new file mode 100644 index 000000000000..d69bd7d08867 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ProvisioningState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of a resource. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Provisioning for ProvisioningState. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * 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 Accepted for ProvisioningState. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * 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. + */ + 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/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/SaasProperties.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/SaasProperties.java new file mode 100644 index 000000000000..a3d459ae09ae --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/SaasProperties.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Details about the SaaS offer purchased from the marketplace. + */ +@Fluent +public final class SaasProperties implements JsonSerializable { + /* + * Subscription ID of the SaaS offer purchased from the marketplace. + */ + private String saasSubscriptionId; + + /* + * Resource ID of the SaaS offer purchased from the marketplace. + */ + private String saasResourceId; + + /** + * Creates an instance of SaasProperties class. + */ + public SaasProperties() { + } + + /** + * Get the saasSubscriptionId property: Subscription ID of the SaaS offer purchased from the marketplace. + * + * @return the saasSubscriptionId value. + */ + public String saasSubscriptionId() { + return this.saasSubscriptionId; + } + + /** + * Set the saasSubscriptionId property: Subscription ID of the SaaS offer purchased from the marketplace. + * + * @param saasSubscriptionId the saasSubscriptionId value to set. + * @return the SaasProperties object itself. + */ + public SaasProperties withSaasSubscriptionId(String saasSubscriptionId) { + this.saasSubscriptionId = saasSubscriptionId; + return this; + } + + /** + * Get the saasResourceId property: Resource ID of the SaaS offer purchased from the marketplace. + * + * @return the saasResourceId value. + */ + public String saasResourceId() { + return this.saasResourceId; + } + + /** + * Set the saasResourceId property: Resource ID of the SaaS offer purchased from the marketplace. + * + * @param saasResourceId the saasResourceId value to set. + * @return the SaasProperties object itself. + */ + public SaasProperties withSaasResourceId(String saasResourceId) { + this.saasResourceId = saasResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("saasSubscriptionId", this.saasSubscriptionId); + jsonWriter.writeStringField("saasResourceId", this.saasResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SaasProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SaasProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SaasProperties. + */ + public static SaasProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SaasProperties deserializedSaasProperties = new SaasProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("saasSubscriptionId".equals(fieldName)) { + deserializedSaasProperties.saasSubscriptionId = reader.getString(); + } else if ("saasResourceId".equals(fieldName)) { + deserializedSaasProperties.saasResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSaasProperties; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Status.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Status.java new file mode 100644 index 000000000000..d3967e1c8ab7 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Status.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Description of the current status of the OperatorApiConnection resource. + */ +@Fluent +public final class Status implements JsonSerializable { + /* + * Current state of the OperatorApiConnection resource. + */ + private String state; + + /* + * Explanation of the current state of the OperatorApiConnection resource. + */ + private String reason; + + /** + * Creates an instance of Status class. + */ + public Status() { + } + + /** + * Get the state property: Current state of the OperatorApiConnection resource. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: Current state of the OperatorApiConnection resource. + * + * @param state the state value to set. + * @return the Status object itself. + */ + public Status withState(String state) { + this.state = state; + return this; + } + + /** + * Get the reason property: Explanation of the current state of the OperatorApiConnection resource. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: Explanation of the current state of the OperatorApiConnection resource. + * + * @param reason the reason value to set. + * @return the Status object itself. + */ + public Status withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state); + jsonWriter.writeStringField("reason", this.reason); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Status from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Status if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Status. + */ + public static Status fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Status deserializedStatus = new Status(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedStatus.state = reader.getString(); + } else if ("reason".equals(fieldName)) { + deserializedStatus.reason = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStatus; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/package-info.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/package-info.java new file mode 100644 index 000000000000..730017e2c96c --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for ProgrammableConnectivity. + * Azure Programmable Connectivity Provider management API. + */ +package com.azure.resourcemanager.programmableconnectivity.models; diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/package-info.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/package-info.java new file mode 100644 index 000000000000..4b0c18a5f7ec --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for ProgrammableConnectivity. + * Azure Programmable Connectivity Provider management API. + */ +package com.azure.resourcemanager.programmableconnectivity; diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/module-info.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/module-info.java new file mode 100644 index 000000000000..3d6b0b9ca856 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/module-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.programmableconnectivity { + requires transitive com.azure.core.management; + exports com.azure.resourcemanager.programmableconnectivity; + exports com.azure.resourcemanager.programmableconnectivity.fluent; + exports com.azure.resourcemanager.programmableconnectivity.fluent.models; + exports com.azure.resourcemanager.programmableconnectivity.models; + opens com.azure.resourcemanager.programmableconnectivity.fluent.models to com.azure.core; + opens com.azure.resourcemanager.programmableconnectivity.models to com.azure.core; +} \ No newline at end of file diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-programmableconnectivity/proxy-config.json b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-programmableconnectivity/proxy-config.json new file mode 100644 index 000000000000..38bb04b6a08b --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-programmableconnectivity/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.programmableconnectivity.implementation.GatewaysClientImpl$GatewaysService"],["com.azure.resourcemanager.programmableconnectivity.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.programmableconnectivity.implementation.OperatorApiConnectionsClientImpl$OperatorApiConnectionsService"],["com.azure.resourcemanager.programmableconnectivity.implementation.OperatorApiPlansClientImpl$OperatorApiPlansService"]] \ No newline at end of file diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-programmableconnectivity/reflect-config.json b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-programmableconnectivity/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-programmableconnectivity/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysCreateOrUpdateSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysCreateOrUpdateSamples.java new file mode 100644 index 000000000000..2f83cc94d052 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysCreateOrUpdateSamples.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.programmableconnectivity.generated; + +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Gateways CreateOrUpdate. + */ +public final class GatewaysCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Gateways_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_CreateOrUpdate. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysCreateOrUpdate( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways() + .define("pgzk") + .withRegion("oryhozfmeohscezl") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("key2642", "fakeTokenPlaceholder")) + .create(); + } + + // Use "Map.of" if available + @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/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysDeleteSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysDeleteSamples.java new file mode 100644 index 000000000000..a3bcf8df6273 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for Gateways Delete. + */ +public final class GatewaysDeleteSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Gateways_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: Gateways_Delete. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void + gatewaysDelete(com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways().delete("rgopenapi", "udveaau", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysGetByResourceGroupSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysGetByResourceGroupSamples.java new file mode 100644 index 000000000000..c30e424021f6 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysGetByResourceGroupSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for Gateways GetByResourceGroup. + */ +public final class GatewaysGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Gateways_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_Get. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void + gatewaysGet(com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways() + .getByResourceGroupWithResponse("rgopenapi", "kdgpdkrucfphqtgafao", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysListByResourceGroupSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysListByResourceGroupSamples.java new file mode 100644 index 000000000000..e9d00499870f --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysListByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for Gateways ListByResourceGroup. + */ +public final class GatewaysListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Gateways_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_ListByResourceGroup. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysListByResourceGroup( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysListSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysListSamples.java new file mode 100644 index 000000000000..f7c64b7bf262 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for Gateways List. + */ +public final class GatewaysListSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Gateways_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_ListBySubscription. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysListBySubscription( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysUpdateSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysUpdateSamples.java new file mode 100644 index 000000000000..29e1c0a586c0 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysUpdateSamples.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.programmableconnectivity.generated; + +import com.azure.resourcemanager.programmableconnectivity.models.Gateway; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Gateways Update. + */ +public final class GatewaysUpdateSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Gateways_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_Update. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void + gatewaysUpdate(com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + Gateway resource = manager.gateways() + .getByResourceGroupWithResponse("rgopenapi", "pgzk", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key2642", "fakeTokenPlaceholder")).apply(); + } + + // Use "Map.of" if available + @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/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationsListSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationsListSamples.java new file mode 100644 index 000000000000..73041e2f2502 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void + operationsList(com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsCreateSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsCreateSamples.java new file mode 100644 index 000000000000..38a9f4e01cab --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsCreateSamples.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.resourcemanager.programmableconnectivity.models.AccountType; +import com.azure.resourcemanager.programmableconnectivity.models.ApplicationProperties; +import com.azure.resourcemanager.programmableconnectivity.models.SaasProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for OperatorApiConnections Create. + */ +public final class OperatorApiConnectionsCreateSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiConnections_Create_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Create. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsCreate( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections() + .define("nzsdg") + .withRegion("dwvzfkjoepbmksygazllqryyinn") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("key5536", "fakeTokenPlaceholder")) + .withOperatorApiPlanId( + "/subscriptions/00000000-0000-0000-0000-00000000000/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans/livmzrh") + .withSaasProperties( + new SaasProperties().withSaasSubscriptionId("mgyusmqt").withSaasResourceId("pekejefyvfviabimdrmno")) + .withConfiguredApplication(new ApplicationProperties().withName("idzqqen") + .withApplicationDescription("gjlwegnqvffvsc") + .withApplicationType("f") + .withLegalName("ar") + .withOrganizationDescription("fcueqzlxxr") + .withTaxNumber("ngzv") + .withPrivacyContactEmailAddress("l")) + .withAppId("czgrhbvgr") + .withGatewayId( + "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/example-rg/providers/Microsoft.ProgrammableConnectivity/gateways/cdvcixxcdhjqw") + .withAccountType(AccountType.AZURE_MANAGED) + .withAppSecret("wtxnpes") + .create(); + } + + // Use "Map.of" if available + @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/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsDeleteSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsDeleteSamples.java new file mode 100644 index 000000000000..b09adf96293f --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for OperatorApiConnections Delete. + */ +public final class OperatorApiConnectionsDeleteSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiConnections_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Delete. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsDelete( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections().delete("rgopenapi", "dawr", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsGetByResourceGroupSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..ec618e912ebe --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsGetByResourceGroupSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for OperatorApiConnections GetByResourceGroup. + */ +public final class OperatorApiConnectionsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiConnections_Get_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Get. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsGet( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections() + .getByResourceGroupWithResponse("rgopenapi", "uetzqjrwqtkwgcirdqy", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsListByResourceGroupSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsListByResourceGroupSamples.java new file mode 100644 index 000000000000..81b8c4001edf --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsListByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for OperatorApiConnections ListByResourceGroup. + */ +public final class OperatorApiConnectionsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiConnections_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_ListByResourceGroup. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsListByResourceGroup( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsListSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsListSamples.java new file mode 100644 index 000000000000..59bf94cf6b65 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for OperatorApiConnections List. + */ +public final class OperatorApiConnectionsListSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiConnections_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_ListBySubscription. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsListBySubscription( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsUpdateSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsUpdateSamples.java new file mode 100644 index 000000000000..ff086a469403 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsUpdateSamples.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.resourcemanager.programmableconnectivity.models.ApplicationProperties; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnection; +import com.azure.resourcemanager.programmableconnectivity.models.SaasProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for OperatorApiConnections Update. + */ +public final class OperatorApiConnectionsUpdateSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiConnections_Update_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Update. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsUpdate( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + OperatorApiConnection resource = manager.operatorApiConnections() + .getByResourceGroupWithResponse("rgopenapi", "syefewgf", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key3150", "fakeTokenPlaceholder")) + .withOperatorApiPlanId( + "/subscriptions/00000000-0000-0000-0000-00000000000/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans/yhlygxdwvrzgazbfzyz") + .withSaasProperties( + new SaasProperties().withSaasSubscriptionId("mgyusmqt").withSaasResourceId("pekejefyvfviabimdrmno")) + .withConfiguredApplication(new ApplicationProperties().withName("idzqqen") + .withApplicationDescription("gjlwegnqvffvsc") + .withApplicationType("f") + .withLegalName("ar") + .withOrganizationDescription("fcueqzlxxr") + .withTaxNumber("ngzv") + .withPrivacyContactEmailAddress("l")) + .withAppId("mkfcrn") + .withAppSecret("wtxnpes") + .apply(); + } + + // Use "Map.of" if available + @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/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansGetSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansGetSamples.java new file mode 100644 index 000000000000..ea07b01b7c91 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for OperatorApiPlans Get. + */ +public final class OperatorApiPlansGetSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiPlans_Get_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiPlans_Get. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiPlansGet( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiPlans().getWithResponse("etzfxkqegslnxdhdmzvbtzxahnyq", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansListSamples.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansListSamples.java new file mode 100644 index 000000000000..75040a79f880 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for OperatorApiPlans List. + */ +public final class OperatorApiPlansListSamples { + /* + * x-ms-original-file: + * specification/programmableconnectivity/resource-manager/Microsoft.ProgrammableConnectivity/preview/2024-01-15- + * preview/examples/OperatorApiPlans_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiPlans_ListBySubscription. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiPlansListBySubscription( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiPlans().list(null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programmableconnectivity/ci.yml b/sdk/programmableconnectivity/ci.yml new file mode 100644 index 000000000000..7a65c77b33d3 --- /dev/null +++ b/sdk/programmableconnectivity/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/programmableconnectivity/ci.yml + - sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/ + exclude: + - sdk/programmableconnectivity/pom.xml + - sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/programmableconnectivity/ci.yml + - sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/ + exclude: + - sdk/programmableconnectivity/pom.xml + - sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/pom.xml + +parameters: + - name: release_azureresourcemanagerprogrammableconnectivity + displayName: azure-resourcemanager-programmableconnectivity + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: programmableconnectivity + Artifacts: + - name: azure-resourcemanager-programmableconnectivity + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerprogrammableconnectivity + releaseInBatch: ${{ parameters.release_azureresourcemanagerprogrammableconnectivity }} diff --git a/sdk/programmableconnectivity/pom.xml b/sdk/programmableconnectivity/pom.xml new file mode 100644 index 000000000000..87e701bdde30 --- /dev/null +++ b/sdk/programmableconnectivity/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-programmableconnectivity-service + pom + 1.0.0 + + + azure-resourcemanager-programmableconnectivity + +