diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b04d701dd93c..e701e7c1a875 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -477,6 +477,7 @@ com.azure.resourcemanager:azure-resourcemanager-carbonoptimization;1.0.0-beta.1; com.azure.resourcemanager:azure-resourcemanager-dependencymap;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-portalservicescopilot;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-lambdatesthyperexecute;1.0.0-beta.1;1.0.0-beta.1 +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 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.1;2.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 59226c65adf6..78a5d433e556 100644 --- a/pom.xml +++ b/pom.xml @@ -180,6 +180,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..44b70286f36a --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-05-02) + +- Azure Resource Manager Programmable Connectivity client library for Java. This package contains Microsoft Azure SDK for Programmable Connectivity Management SDK. Azure Programmable Connectivity Provider management API. 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..3554878630b7 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Programmable Connectivity client library for Java + +Azure Resource Manager Programmable Connectivity client library for Java. + +This package contains Microsoft Azure SDK for Programmable Connectivity Management SDK. Azure Programmable Connectivity Provider management API. 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(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ProgrammableConnectivityManager manager = ProgrammableConnectivityManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` 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/ diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/SAMPLE.md b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/SAMPLE.md new file mode 100644 index 000000000000..9c08e65aff38 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/SAMPLE.md @@ -0,0 +1,558 @@ +# 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 com.azure.resourcemanager.programmableconnectivity.models.ApplicationOwnerProperties; +import com.azure.resourcemanager.programmableconnectivity.models.ApplicationProperties; +import com.azure.resourcemanager.programmableconnectivity.models.Category; +import com.azure.resourcemanager.programmableconnectivity.models.GatewayProperties; +import com.azure.resourcemanager.programmableconnectivity.models.GeographicAddress; +import com.azure.resourcemanager.programmableconnectivity.models.LocalRepresentative; +import com.azure.resourcemanager.programmableconnectivity.models.OrganizationType; +import com.azure.resourcemanager.programmableconnectivity.models.Person; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Gateways CreateOrUpdate. + */ +public final class GatewaysCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-03-30-preview/Gateways_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_CreateOrUpdate_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysCreateOrUpdateMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways() + .define("GatewayName") + .withRegion("eastus") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf()) + .withProperties(new GatewayProperties() + .withConfiguredApplication(new ApplicationProperties().withName("Application Name") + .withApplicationDescription("Application description") + .withCategory(Category.ART_AND_DESIGN) + .withCommercialName("Contoso") + .withPrivacyRightsRequestEmailAddress("contact@contoso.com") + .withPrivacyPolicyUrl("http://contoso.com/privacy")) + .withConfiguredApplicationOwner(new ApplicationOwnerProperties().withName("Contoso") + .withLegalName("Contoso") + .withTradingName("Contoso") + .withOrganizationDescription("Description of Organisation") + .withTaxNumber("12345") + .withOrganizationType(OrganizationType.ACADEMIC_SCIENTIFIC_ORGANIZATION) + .withOrganizationIdentificationId("12345") + .withOrganizationIdentificationIssuer("ID issuer") + .withOrganizationIdentificationType("Tax number") + .withContactEmailAddress("contact@contoso.com") + .withLegalRepresentative(new Person().withFamilyName("Name") + .withGivenName("Name") + .withEmailAddress("contact@contoso.com")) + .withPrivacyManager(new Person().withFamilyName("Name") + .withGivenName("Name") + .withEmailAddress("contact@contoso.com")) + .withDataProtectionOfficer(new Person().withFamilyName("Name") + .withGivenName("Name") + .withEmailAddress("contact@contoso.com")) + .withRegisteredGeographicAddress(new GeographicAddress().withStreetNumber("1234") + .withStreetName("Street") + .withLocality("Locality") + .withCity("City") + .withStateOrProvince("State") + .withPostalCode("fakeTokenPlaceholder") + .withCountryCode("fakeTokenPlaceholder")) + .withPrivacyPolicyUrl("http://contoso.com/privacy") + .withLocalRepresentatives( + Arrays.asList(new LocalRepresentative().withCountryCode("fakeTokenPlaceholder") + .withRepresentative(new Person().withFamilyName("Name") + .withGivenName("Name") + .withEmailAddress("contact@contoso.com")))))) + .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 OperatorApiConnections GetByResourceGroup. + */ +public final class OperatorApiConnectionsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiConnections_Get_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Get_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsGetMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections() + .getByResourceGroupWithResponse("rgopenapi", "operatorApiConnectionName", com.azure.core.util.Context.NONE); + } +} +``` + +### Gateways_GetByResourceGroup + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-03-30-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operationsListMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-30-preview/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen - generated by [MinimumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operationsListMaximumSetGenGeneratedByMinimumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Gateways_List + +```java +/** + * Samples for OperatorApiConnections Delete. + */ +public final class OperatorApiConnectionsDeleteSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiConnections_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Delete_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsDeleteMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections() + .delete("rgopenapi", "operatorApiConnectionName", com.azure.core.util.Context.NONE); + } +} +``` + +### Gateways_ListByResourceGroup + +```java +/** + * Samples for Gateways GetByResourceGroup. + */ +public final class GatewaysGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-03-30-preview/Gateways_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_Get_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysGetMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways().getByResourceGroupWithResponse("rgopenapi", "GatewayName", com.azure.core.util.Context.NONE); + } +} +``` + +### Gateways_Update + +```java +/** + * Samples for OperatorApiConnections List. + */ +public final class OperatorApiConnectionsListSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiConnections_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_ListBySubscription_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsListBySubscriptionMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.resourcemanager.programmableconnectivity.models.Context; +import com.azure.resourcemanager.programmableconnectivity.models.DataProcessing; +import com.azure.resourcemanager.programmableconnectivity.models.DataRegions; +import com.azure.resourcemanager.programmableconnectivity.models.DurationModel; +import com.azure.resourcemanager.programmableconnectivity.models.Frequency; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnection; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnectionUpdateProperties; +import com.azure.resourcemanager.programmableconnectivity.models.ProcessingOperation; +import com.azure.resourcemanager.programmableconnectivity.models.Purpose; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for OperatorApiConnections Update. + */ +public final class OperatorApiConnectionsUpdateSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiConnections_Update_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Update_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsUpdateMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + OperatorApiConnection resource = manager.operatorApiConnections() + .getByResourceGroupWithResponse("rgopenapi", "operatorApiConnectionName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf()) + .withProperties(new OperatorApiConnectionUpdateProperties().withOperatorApiPlanId( + "/subscriptions/00000000-0000-0000-0000-00000000000/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans/livmzrh") + .withPlanTermsAndConditionsAccepted(true) + .withPurposes(Arrays.asList(Purpose.fromString("Fraud Detection and Prevention"))) + .withPurposeReason("This application uses this API for this purpose because...") + .withDataProcessingList( + Arrays.asList(new DataProcessing().withProcessingOperation(ProcessingOperation.ACCESS) + .withContexts(Arrays.asList(Context.ALGORITHMIC_LOGIC)) + .withDuration(DurationModel.ENDLESS_DURATION) + .withFrequency(Frequency.CONTINUOUS_FREQUENCY) + .withTransitRegions(Arrays.asList(new DataRegions().withCountryCode("fakeTokenPlaceholder") + .withCommercialOrganization("Contoso") + .withCommercialActivity(true) + .withDataPrivacyFrameworkUrl("https://www.dataprivacyframework.gov/participant/0"))) + .withStorageRegions(Arrays.asList(new DataRegions().withCountryCode("fakeTokenPlaceholder") + .withCommercialOrganization("Contoso") + .withCommercialActivity(true) + .withDataPrivacyFrameworkUrl("https://www.dataprivacyframework.gov/participant/0")))))) + .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; + } +} +``` + +### OperatorApiConnections_Create + +```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: 2025-03-30-preview/Gateways_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_Update_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysUpdateMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + Gateway resource = manager.gateways() + .getByResourceGroupWithResponse("rgopenapi", "GatewayName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).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; + } +} +``` + +### OperatorApiConnections_Delete + +```java +/** + * Samples for OperatorApiPlans List. + */ +public final class OperatorApiPlansListSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiPlans_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiPlans_ListBySubscription_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiPlansListBySubscriptionMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiPlans().list("lbnapngejadkls", 18, 2, com.azure.core.util.Context.NONE); + } +} +``` + +### OperatorApiConnections_GetByResourceGroup + +```java +/** + * Samples for Gateways Delete. + */ +public final class GatewaysDeleteSamples { + /* + * x-ms-original-file: 2025-03-30-preview/Gateways_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_Delete_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysDeleteMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways().delete("rgopenapi", "GatewayName", com.azure.core.util.Context.NONE); + } +} +``` + +### OperatorApiConnections_List + +```java +import com.azure.resourcemanager.programmableconnectivity.models.Context; +import com.azure.resourcemanager.programmableconnectivity.models.DataProcessing; +import com.azure.resourcemanager.programmableconnectivity.models.DataRegions; +import com.azure.resourcemanager.programmableconnectivity.models.DurationModel; +import com.azure.resourcemanager.programmableconnectivity.models.Frequency; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnectionProperties; +import com.azure.resourcemanager.programmableconnectivity.models.ProcessingOperation; +import com.azure.resourcemanager.programmableconnectivity.models.Purpose; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for OperatorApiConnections Create. + */ +public final class OperatorApiConnectionsCreateSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiConnections_Create_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Create_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsCreateMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections() + .define("operatorApiConnectionName") + .withRegion("eastus") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf()) + .withProperties(new OperatorApiConnectionProperties().withOperatorApiPlanId( + "/subscriptions/00000000-0000-0000-0000-00000000000/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans/livmzrh") + .withGatewayId( + "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/example-rg/providers/Microsoft.ProgrammableConnectivity/gateways/cdvcixxcdhjqw") + .withPlanTermsAndConditionsAccepted(true) + .withPurposes(Arrays.asList(Purpose.fromString("Fraud Detection and Prevention"))) + .withPurposeReason("This application uses this API for this purpose because...") + .withDataProcessingList( + Arrays.asList(new DataProcessing().withProcessingOperation(ProcessingOperation.ACCESS) + .withContexts(Arrays.asList(Context.ALGORITHMIC_LOGIC)) + .withDuration(DurationModel.ENDLESS_DURATION) + .withFrequency(Frequency.CONTINUOUS_FREQUENCY) + .withTransitRegions(Arrays.asList(new DataRegions().withCountryCode("fakeTokenPlaceholder") + .withCommercialOrganization("Contoso") + .withCommercialActivity(true) + .withDataPrivacyFrameworkUrl("https://www.dataprivacyframework.gov/participant/0"))) + .withStorageRegions(Arrays.asList(new DataRegions().withCountryCode("fakeTokenPlaceholder") + .withCommercialOrganization("Contoso") + .withCommercialActivity(true) + .withDataPrivacyFrameworkUrl("https://www.dataprivacyframework.gov/participant/0")))))) + .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_ListByResourceGroup + +```java +/** + * Samples for OperatorApiPlans Get. + */ +public final class OperatorApiPlansGetSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiPlans_Get_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiPlans_Get_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiPlansGetMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiPlans().getWithResponse("operatorApiPlanName", com.azure.core.util.Context.NONE); + } +} +``` + +### OperatorApiConnections_Update + +```java +/** + * Samples for Gateways List. + */ +public final class GatewaysListSamples { + /* + * x-ms-original-file: 2025-03-30-preview/Gateways_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_ListBySubscription_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysListBySubscriptionMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways().list(com.azure.core.util.Context.NONE); + } +} +``` + +### OperatorApiPlans_Get + +```java +/** + * Samples for Gateways ListByResourceGroup. + */ +public final class GatewaysListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-03-30-preview/Gateways_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_ListByResourceGroup_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysListByResourceGroupMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} +``` + +### OperatorApiPlans_List + +```java +/** + * Samples for OperatorApiConnections ListByResourceGroup. + */ +public final class OperatorApiConnectionsListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiConnections_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_ListByResourceGroup_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsListByResourceGroupMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections().listByResourceGroup("rgopenapi", 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..8d5b8de7ec21 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/pom.xml @@ -0,0 +1,74 @@ + + + 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 Programmable Connectivity Management + This package contains Microsoft Azure SDK for Programmable Connectivity Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Programmable Connectivity Provider management API. + 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-core + 1.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + com.azure + azure-core-test + 1.27.0-beta.8 + test + + + com.azure + azure-identity + 1.15.4 + test + + + 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..14ba0ac78841 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/ProgrammableConnectivityManager.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.programmableconnectivity.fluent.ProgrammableConnectivityMgmtClient; +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.ProgrammableConnectivityMgmtClientBuilder; +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.Map; +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 ProgrammableConnectivityMgmtClient 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 ProgrammableConnectivityMgmtClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Programmable Connectivity service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Programmable Connectivity 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 Programmable Connectivity service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Programmable Connectivity 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 static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-programmableconnectivity.properties"); + + 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 Programmable Connectivity service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Programmable Connectivity service API instance. + */ + public ProgrammableConnectivityManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.programmableconnectivity") + .append("/") + .append(clientVersion); + 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 BearerTokenAuthenticationPolicy(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 ProgrammableConnectivityMgmtClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client ProgrammableConnectivityMgmtClient. + */ + public ProgrammableConnectivityMgmtClient 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..17dd4a016458 --- /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) TypeSpec 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 { + /** + * 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); + + /** + * 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); + + /** + * 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); +} 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..c2e7aa2adcea --- /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) TypeSpec 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..6057e5d30502 --- /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) TypeSpec 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 { + /** + * 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); + + /** + * 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); + + /** + * 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); +} 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..c28c75202384 --- /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) TypeSpec 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 { + /** + * 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); + + /** + * 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); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/ProgrammableConnectivityMgmtClient.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/ProgrammableConnectivityMgmtClient.java new file mode 100644 index 000000000000..e315357ee624 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/ProgrammableConnectivityMgmtClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ProgrammableConnectivityMgmtClient class. + */ +public interface ProgrammableConnectivityMgmtClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * 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..ec449641f434 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/GatewayInner.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.models.GatewayProperties; +import java.io.IOException; +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 properties; + + /* + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public GatewayProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the GatewayInner object itself. + */ + public GatewayInner withProperties(GatewayProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@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.properties); + 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.properties = 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/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..a4ee3f68c15f --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperationInner.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.ActionType; +import com.azure.resourcemanager.programmableconnectivity.models.OperationDisplay; +import com.azure.resourcemanager.programmableconnectivity.models.Origin; +import java.io.IOException; + +/** + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +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 Azure + * Resource Manager/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; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private 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 Azure Resource Manager/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; + } + + /** + * 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: Extensible 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..14242fb5f1ed --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiConnectionInner.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnectionProperties; +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 properties; + + /* + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public OperatorApiConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the OperatorApiConnectionInner object itself. + */ + public OperatorApiConnectionInner withProperties(OperatorApiConnectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@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.properties); + 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.properties + = 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/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..802124c990d6 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/fluent/models/OperatorApiPlanInner.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.fluent.models; + +import com.azure.core.annotation.Immutable; +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.OperatorApiPlanProperties; +import java.io.IOException; + +/** + * 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. + */ +@Immutable +public final class OperatorApiPlanInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private OperatorApiPlanProperties properties; + + /* + * 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. + */ + private OperatorApiPlanInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public OperatorApiPlanProperties properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + 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.properties = 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/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..134f8ce86f13 --- /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) TypeSpec 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..04ab1c8e40ed --- /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) TypeSpec 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..8c34643700c0 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/GatewayImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GatewayProperties; +import com.azure.resourcemanager.programmableconnectivity.models.GatewayTagsUpdate; +import java.util.Collections; +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 GatewayProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + 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; + } + } + + public GatewayImpl withProperties(GatewayProperties properties) { + this.innerModel().withProperties(properties); + 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..96ee2f465f91 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/GatewaysClientImpl.java @@ -0,0 +1,1179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.implementation.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 ProgrammableConnectivityMgmtClientImpl client; + + /** + * Initializes an instance of GatewaysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GatewaysClientImpl(ProgrammableConnectivityMgmtClientImpl client) { + this.service = RestProxy.create(GatewaysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ProgrammableConnectivityMgmtClientGateways to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ProgrammableConnecti") + public interface GatewaysService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/gateways/{gatewayName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") 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); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/gateways/{gatewayName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("gatewayName") String gatewayName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") GatewayInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/gateways/{gatewayName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("gatewayName") String gatewayName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") GatewayTagsUpdate properties, 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("endpoint") 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("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/gateways") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") 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}/providers/Microsoft.ProgrammableConnectivity/gateways") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, 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 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, gatewayName, contentType, accept, resource, + 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 contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, gatewayName, contentType, accept, resource, 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, gatewayName, contentType, accept, properties, 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 contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, gatewayName, contentType, accept, properties, 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(); + } + + /** + * 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)); + } + + /** + * 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)); + } + + /** + * 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)); + } + + /** + * 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)); + } +} 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..eb541bef3689 --- /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) TypeSpec 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 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 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 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 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..718a412dc7a6 --- /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) TypeSpec 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..bf1f7811400b --- /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) TypeSpec 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.implementation.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 ProgrammableConnectivityMgmtClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ProgrammableConnectivityMgmtClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ProgrammableConnectivityMgmtClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ProgrammableConnecti") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.ProgrammableConnectivity/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") 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("endpoint") 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..398d21341344 --- /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) TypeSpec 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..0f9d73bae263 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiConnectionImpl.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.OperatorApiConnection; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnectionProperties; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnectionUpdate; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnectionUpdateProperties; +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 OperatorApiConnectionProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + 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 withProperties(OperatorApiConnectionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public OperatorApiConnectionImpl withProperties(OperatorApiConnectionUpdateProperties properties) { + this.updateProperties.withProperties(properties); + 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..b50e30902883 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiConnectionsClientImpl.java @@ -0,0 +1,1307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.implementation.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 ProgrammableConnectivityMgmtClientImpl client; + + /** + * Initializes an instance of OperatorApiConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperatorApiConnectionsClientImpl(ProgrammableConnectivityMgmtClientImpl client) { + this.service = RestProxy.create(OperatorApiConnectionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ProgrammableConnectivityMgmtClientOperatorApiConnections to be used + * by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ProgrammableConnecti") + public interface OperatorApiConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections/{operatorApiConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") 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); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections/{operatorApiConnectionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("operatorApiConnectionName") String operatorApiConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") OperatorApiConnectionInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections/{operatorApiConnectionName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("operatorApiConnectionName") String operatorApiConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") OperatorApiConnectionUpdate properties, 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("endpoint") 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("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") 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}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, 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 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, operatorApiConnectionName, contentType, accept, + resource, 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 contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, operatorApiConnectionName, contentType, accept, resource, 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, operatorApiConnectionName, contentType, accept, + properties, 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 contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, operatorApiConnectionName, contentType, accept, properties, 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(); + } + + /** + * 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)); + } + + /** + * 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)); + } + + /** + * 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)); + } + + /** + * 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)); + } +} 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..e5f798eb0da1 --- /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) TypeSpec 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 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 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 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 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..81ea53129df7 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/OperatorApiPlanImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.OperatorApiPlan; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiPlanProperties; + +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 OperatorApiPlanProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + 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..65fced05e3fd --- /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) TypeSpec 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.implementation.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 ProgrammableConnectivityMgmtClientImpl client; + + /** + * Initializes an instance of OperatorApiPlansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperatorApiPlansClientImpl(ProgrammableConnectivityMgmtClientImpl client) { + this.service + = RestProxy.create(OperatorApiPlansService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ProgrammableConnectivityMgmtClientOperatorApiPlans to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ProgrammableConnecti") + public interface OperatorApiPlansService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans/{operatorApiPlanName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") 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("/subscriptions/{subscriptionId}/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") 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("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context 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(); + } + + /** + * 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 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..d75741a00593 --- /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) TypeSpec 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 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; + } + } + + 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())); + } + + 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/ProgrammableConnectivityMgmtClientBuilder.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ProgrammableConnectivityMgmtClientBuilder.java new file mode 100644 index 000000000000..26e039d92335 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ProgrammableConnectivityMgmtClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 ProgrammableConnectivityMgmtClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ProgrammableConnectivityMgmtClientImpl.class }) +public final class ProgrammableConnectivityMgmtClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ProgrammableConnectivityMgmtClientBuilder. + */ + public ProgrammableConnectivityMgmtClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * 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 ProgrammableConnectivityMgmtClientBuilder. + */ + public ProgrammableConnectivityMgmtClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ProgrammableConnectivityMgmtClientBuilder. + */ + public ProgrammableConnectivityMgmtClientBuilder 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 ProgrammableConnectivityMgmtClientBuilder. + */ + public ProgrammableConnectivityMgmtClientBuilder 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 ProgrammableConnectivityMgmtClientBuilder. + */ + public ProgrammableConnectivityMgmtClientBuilder 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 ProgrammableConnectivityMgmtClientBuilder. + */ + public ProgrammableConnectivityMgmtClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ProgrammableConnectivityMgmtClientImpl with the provided parameters. + * + * @return an instance of ProgrammableConnectivityMgmtClientImpl. + */ + public ProgrammableConnectivityMgmtClientImpl 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(); + ProgrammableConnectivityMgmtClientImpl client = new ProgrammableConnectivityMgmtClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ProgrammableConnectivityMgmtClientImpl.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ProgrammableConnectivityMgmtClientImpl.java new file mode 100644 index 000000000000..3752484db5a8 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/ProgrammableConnectivityMgmtClientImpl.java @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.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.ProgrammableConnectivityMgmtClient; +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 ProgrammableConnectivityMgmtClientImpl type. + */ +@ServiceClient(builder = ProgrammableConnectivityMgmtClientBuilder.class) +public final class ProgrammableConnectivityMgmtClientImpl implements ProgrammableConnectivityMgmtClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * 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; + } + + /** + * 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 ProgrammableConnectivityMgmtClient 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 endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + ProgrammableConnectivityMgmtClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2025-03-30-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(ProgrammableConnectivityMgmtClientImpl.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..ef7669308678 --- /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) TypeSpec 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/models/GatewayListResult.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/models/GatewayListResult.java new file mode 100644 index 000000000000..7c325fe9a01c --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/models/GatewayListResult.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.implementation.models; + +import com.azure.core.annotation.Immutable; +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. + */ +@Immutable +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. + */ + private GatewayListResult() { + } + + /** + * Get the value property: The Gateway items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @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) { + 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/implementation/models/OperationListResult.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..29acb9577e74 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/models/OperationListResult.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.implementation.models; + +import com.azure.core.annotation.Immutable; +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.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 { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @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) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model OperationListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationListResult.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 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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/implementation/models/OperatorApiConnectionListResult.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/models/OperatorApiConnectionListResult.java new file mode 100644 index 000000000000..ea57c901f0b3 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/models/OperatorApiConnectionListResult.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.implementation.models; + +import com.azure.core.annotation.Immutable; +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. + */ +@Immutable +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. + */ + private OperatorApiConnectionListResult() { + } + + /** + * Get the value property: The OperatorApiConnection items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @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) { + 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/implementation/models/OperatorApiPlanListResult.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/models/OperatorApiPlanListResult.java new file mode 100644 index 000000000000..fa9657ab8a43 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/implementation/models/OperatorApiPlanListResult.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.implementation.models; + +import com.azure.core.annotation.Immutable; +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. + */ +@Immutable +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. + */ + private OperatorApiPlanListResult() { + } + + /** + * Get the value property: The OperatorApiPlan items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @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) { + 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/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..b5a39ec3e96f --- /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) TypeSpec 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/ActionType.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ActionType.java new file mode 100644 index 000000000000..6ac83d1c30c7 --- /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) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Actions are for internal-only APIs. + */ + 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/ApplicationOwnerProperties.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ApplicationOwnerProperties.java new file mode 100644 index 000000000000..e76f83cae761 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ApplicationOwnerProperties.java @@ -0,0 +1,620 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 java.io.IOException; +import java.util.List; + +/** + * Details about the Application Owner (i.e. organization) that would use the Operator's Network APIs. + */ +@Fluent +public final class ApplicationOwnerProperties implements JsonSerializable { + /* + * Common name of the organization owning the application. + */ + private String name; + + /* + * Legal name of the organization owning the application. + */ + private String legalName; + + /* + * Trading name of the organization owning the application. + */ + private String tradingName; + + /* + * 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; + + /* + * The type of organization that the Application Owner is. + */ + private OrganizationType organizationType; + + /* + * ID number for official identification of the organization. + */ + private String organizationIdentificationId; + + /* + * Issuing organization of the ID for official identification of the organization. + */ + private String organizationIdentificationIssuer; + + /* + * Type of official identification of the organization. + */ + private String organizationIdentificationType; + + /* + * Email address for the person responsible for the use of Network APIs in this application. + */ + private String contactEmailAddress; + + /* + * Legal representative of the organization. + */ + private Person legalRepresentative; + + /* + * Privacy manager of the organization. + */ + private Person privacyManager; + + /* + * Data Protection Officer of the organization. + */ + private Person dataProtectionOfficer; + + /* + * Registered Geographic address. + */ + private GeographicAddress registeredGeographicAddress; + + /* + * URL for the organization's privacy policy. + */ + private String privacyPolicyUrl; + + /* + * List of local representatives. + */ + private List localRepresentatives; + + /** + * Creates an instance of ApplicationOwnerProperties class. + */ + public ApplicationOwnerProperties() { + } + + /** + * Get the name property: Common name of the organization owning the application. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Common name of the organization owning the application. + * + * @param name the name value to set. + * @return the ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withName(String name) { + this.name = name; + 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 ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withLegalName(String legalName) { + this.legalName = legalName; + return this; + } + + /** + * Get the tradingName property: Trading name of the organization owning the application. + * + * @return the tradingName value. + */ + public String tradingName() { + return this.tradingName; + } + + /** + * Set the tradingName property: Trading name of the organization owning the application. + * + * @param tradingName the tradingName value to set. + * @return the ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withTradingName(String tradingName) { + this.tradingName = tradingName; + 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 ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties 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 ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withTaxNumber(String taxNumber) { + this.taxNumber = taxNumber; + return this; + } + + /** + * Get the organizationType property: The type of organization that the Application Owner is. + * + * @return the organizationType value. + */ + public OrganizationType organizationType() { + return this.organizationType; + } + + /** + * Set the organizationType property: The type of organization that the Application Owner is. + * + * @param organizationType the organizationType value to set. + * @return the ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withOrganizationType(OrganizationType organizationType) { + this.organizationType = organizationType; + return this; + } + + /** + * Get the organizationIdentificationId property: ID number for official identification of the organization. + * + * @return the organizationIdentificationId value. + */ + public String organizationIdentificationId() { + return this.organizationIdentificationId; + } + + /** + * Set the organizationIdentificationId property: ID number for official identification of the organization. + * + * @param organizationIdentificationId the organizationIdentificationId value to set. + * @return the ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withOrganizationIdentificationId(String organizationIdentificationId) { + this.organizationIdentificationId = organizationIdentificationId; + return this; + } + + /** + * Get the organizationIdentificationIssuer property: Issuing organization of the ID for official identification of + * the organization. + * + * @return the organizationIdentificationIssuer value. + */ + public String organizationIdentificationIssuer() { + return this.organizationIdentificationIssuer; + } + + /** + * Set the organizationIdentificationIssuer property: Issuing organization of the ID for official identification of + * the organization. + * + * @param organizationIdentificationIssuer the organizationIdentificationIssuer value to set. + * @return the ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withOrganizationIdentificationIssuer(String organizationIdentificationIssuer) { + this.organizationIdentificationIssuer = organizationIdentificationIssuer; + return this; + } + + /** + * Get the organizationIdentificationType property: Type of official identification of the organization. + * + * @return the organizationIdentificationType value. + */ + public String organizationIdentificationType() { + return this.organizationIdentificationType; + } + + /** + * Set the organizationIdentificationType property: Type of official identification of the organization. + * + * @param organizationIdentificationType the organizationIdentificationType value to set. + * @return the ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withOrganizationIdentificationType(String organizationIdentificationType) { + this.organizationIdentificationType = organizationIdentificationType; + return this; + } + + /** + * Get the contactEmailAddress property: Email address for the person responsible for the use of Network APIs in + * this application. + * + * @return the contactEmailAddress value. + */ + public String contactEmailAddress() { + return this.contactEmailAddress; + } + + /** + * Set the contactEmailAddress property: Email address for the person responsible for the use of Network APIs in + * this application. + * + * @param contactEmailAddress the contactEmailAddress value to set. + * @return the ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withContactEmailAddress(String contactEmailAddress) { + this.contactEmailAddress = contactEmailAddress; + return this; + } + + /** + * Get the legalRepresentative property: Legal representative of the organization. + * + * @return the legalRepresentative value. + */ + public Person legalRepresentative() { + return this.legalRepresentative; + } + + /** + * Set the legalRepresentative property: Legal representative of the organization. + * + * @param legalRepresentative the legalRepresentative value to set. + * @return the ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withLegalRepresentative(Person legalRepresentative) { + this.legalRepresentative = legalRepresentative; + return this; + } + + /** + * Get the privacyManager property: Privacy manager of the organization. + * + * @return the privacyManager value. + */ + public Person privacyManager() { + return this.privacyManager; + } + + /** + * Set the privacyManager property: Privacy manager of the organization. + * + * @param privacyManager the privacyManager value to set. + * @return the ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withPrivacyManager(Person privacyManager) { + this.privacyManager = privacyManager; + return this; + } + + /** + * Get the dataProtectionOfficer property: Data Protection Officer of the organization. + * + * @return the dataProtectionOfficer value. + */ + public Person dataProtectionOfficer() { + return this.dataProtectionOfficer; + } + + /** + * Set the dataProtectionOfficer property: Data Protection Officer of the organization. + * + * @param dataProtectionOfficer the dataProtectionOfficer value to set. + * @return the ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withDataProtectionOfficer(Person dataProtectionOfficer) { + this.dataProtectionOfficer = dataProtectionOfficer; + return this; + } + + /** + * Get the registeredGeographicAddress property: Registered Geographic address. + * + * @return the registeredGeographicAddress value. + */ + public GeographicAddress registeredGeographicAddress() { + return this.registeredGeographicAddress; + } + + /** + * Set the registeredGeographicAddress property: Registered Geographic address. + * + * @param registeredGeographicAddress the registeredGeographicAddress value to set. + * @return the ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withRegisteredGeographicAddress(GeographicAddress registeredGeographicAddress) { + this.registeredGeographicAddress = registeredGeographicAddress; + return this; + } + + /** + * Get the privacyPolicyUrl property: URL for the organization's privacy policy. + * + * @return the privacyPolicyUrl value. + */ + public String privacyPolicyUrl() { + return this.privacyPolicyUrl; + } + + /** + * Set the privacyPolicyUrl property: URL for the organization's privacy policy. + * + * @param privacyPolicyUrl the privacyPolicyUrl value to set. + * @return the ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withPrivacyPolicyUrl(String privacyPolicyUrl) { + this.privacyPolicyUrl = privacyPolicyUrl; + return this; + } + + /** + * Get the localRepresentatives property: List of local representatives. + * + * @return the localRepresentatives value. + */ + public List localRepresentatives() { + return this.localRepresentatives; + } + + /** + * Set the localRepresentatives property: List of local representatives. + * + * @param localRepresentatives the localRepresentatives value to set. + * @return the ApplicationOwnerProperties object itself. + */ + public ApplicationOwnerProperties withLocalRepresentatives(List localRepresentatives) { + this.localRepresentatives = localRepresentatives; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property name in model ApplicationOwnerProperties")); + } + if (legalName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property legalName in model ApplicationOwnerProperties")); + } + if (tradingName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tradingName in model ApplicationOwnerProperties")); + } + if (organizationDescription() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property organizationDescription in model ApplicationOwnerProperties")); + } + if (taxNumber() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property taxNumber in model ApplicationOwnerProperties")); + } + if (organizationType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property organizationType in model ApplicationOwnerProperties")); + } + if (organizationIdentificationId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property organizationIdentificationId in model ApplicationOwnerProperties")); + } + if (organizationIdentificationIssuer() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property organizationIdentificationIssuer in model ApplicationOwnerProperties")); + } + if (organizationIdentificationType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property organizationIdentificationType in model ApplicationOwnerProperties")); + } + if (contactEmailAddress() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property contactEmailAddress in model ApplicationOwnerProperties")); + } + if (legalRepresentative() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property legalRepresentative in model ApplicationOwnerProperties")); + } else { + legalRepresentative().validate(); + } + if (privacyManager() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property privacyManager in model ApplicationOwnerProperties")); + } else { + privacyManager().validate(); + } + if (dataProtectionOfficer() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataProtectionOfficer in model ApplicationOwnerProperties")); + } else { + dataProtectionOfficer().validate(); + } + if (registeredGeographicAddress() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property registeredGeographicAddress in model ApplicationOwnerProperties")); + } else { + registeredGeographicAddress().validate(); + } + if (privacyPolicyUrl() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property privacyPolicyUrl in model ApplicationOwnerProperties")); + } + if (localRepresentatives() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property localRepresentatives in model ApplicationOwnerProperties")); + } else { + localRepresentatives().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApplicationOwnerProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("legalName", this.legalName); + jsonWriter.writeStringField("tradingName", this.tradingName); + jsonWriter.writeStringField("organizationDescription", this.organizationDescription); + jsonWriter.writeStringField("taxNumber", this.taxNumber); + jsonWriter.writeStringField("organizationType", + this.organizationType == null ? null : this.organizationType.toString()); + jsonWriter.writeStringField("organizationIdentificationId", this.organizationIdentificationId); + jsonWriter.writeStringField("organizationIdentificationIssuer", this.organizationIdentificationIssuer); + jsonWriter.writeStringField("organizationIdentificationType", this.organizationIdentificationType); + jsonWriter.writeStringField("contactEmailAddress", this.contactEmailAddress); + jsonWriter.writeJsonField("legalRepresentative", this.legalRepresentative); + jsonWriter.writeJsonField("privacyManager", this.privacyManager); + jsonWriter.writeJsonField("dataProtectionOfficer", this.dataProtectionOfficer); + jsonWriter.writeJsonField("registeredGeographicAddress", this.registeredGeographicAddress); + jsonWriter.writeStringField("privacyPolicyUrl", this.privacyPolicyUrl); + jsonWriter.writeArrayField("localRepresentatives", this.localRepresentatives, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApplicationOwnerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApplicationOwnerProperties 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 ApplicationOwnerProperties. + */ + public static ApplicationOwnerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApplicationOwnerProperties deserializedApplicationOwnerProperties = new ApplicationOwnerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedApplicationOwnerProperties.name = reader.getString(); + } else if ("legalName".equals(fieldName)) { + deserializedApplicationOwnerProperties.legalName = reader.getString(); + } else if ("tradingName".equals(fieldName)) { + deserializedApplicationOwnerProperties.tradingName = reader.getString(); + } else if ("organizationDescription".equals(fieldName)) { + deserializedApplicationOwnerProperties.organizationDescription = reader.getString(); + } else if ("taxNumber".equals(fieldName)) { + deserializedApplicationOwnerProperties.taxNumber = reader.getString(); + } else if ("organizationType".equals(fieldName)) { + deserializedApplicationOwnerProperties.organizationType + = OrganizationType.fromString(reader.getString()); + } else if ("organizationIdentificationId".equals(fieldName)) { + deserializedApplicationOwnerProperties.organizationIdentificationId = reader.getString(); + } else if ("organizationIdentificationIssuer".equals(fieldName)) { + deserializedApplicationOwnerProperties.organizationIdentificationIssuer = reader.getString(); + } else if ("organizationIdentificationType".equals(fieldName)) { + deserializedApplicationOwnerProperties.organizationIdentificationType = reader.getString(); + } else if ("contactEmailAddress".equals(fieldName)) { + deserializedApplicationOwnerProperties.contactEmailAddress = reader.getString(); + } else if ("legalRepresentative".equals(fieldName)) { + deserializedApplicationOwnerProperties.legalRepresentative = Person.fromJson(reader); + } else if ("privacyManager".equals(fieldName)) { + deserializedApplicationOwnerProperties.privacyManager = Person.fromJson(reader); + } else if ("dataProtectionOfficer".equals(fieldName)) { + deserializedApplicationOwnerProperties.dataProtectionOfficer = Person.fromJson(reader); + } else if ("registeredGeographicAddress".equals(fieldName)) { + deserializedApplicationOwnerProperties.registeredGeographicAddress + = GeographicAddress.fromJson(reader); + } else if ("privacyPolicyUrl".equals(fieldName)) { + deserializedApplicationOwnerProperties.privacyPolicyUrl = reader.getString(); + } else if ("localRepresentatives".equals(fieldName)) { + List localRepresentatives + = reader.readArray(reader1 -> LocalRepresentative.fromJson(reader1)); + deserializedApplicationOwnerProperties.localRepresentatives = localRepresentatives; + } else { + reader.skipChildren(); + } + } + + return deserializedApplicationOwnerProperties; + }); + } +} 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..feeecd5ebd1a --- /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) TypeSpec 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 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. + */ + private String name; + + /* + * Description of the application. + */ + private String applicationDescription; + + /* + * The category of the application. + */ + private Category category; + + /* + * Commercial name of the application. + */ + private String commercialName; + + /* + * Privacy rights request email address. + */ + private String privacyRightsRequestEmailAddress; + + /* + * URL for the organization's privacy policy. + */ + private String privacyPolicyUrl; + + /** + * Creates an instance of ApplicationProperties class. + */ + public ApplicationProperties() { + } + + /** + * Get the name property: Name of the application. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the application. + * + * @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 category property: The category of the application. + * + * @return the category value. + */ + public Category category() { + return this.category; + } + + /** + * Set the category property: The category of the application. + * + * @param category the category value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withCategory(Category category) { + this.category = category; + return this; + } + + /** + * Get the commercialName property: Commercial name of the application. + * + * @return the commercialName value. + */ + public String commercialName() { + return this.commercialName; + } + + /** + * Set the commercialName property: Commercial name of the application. + * + * @param commercialName the commercialName value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withCommercialName(String commercialName) { + this.commercialName = commercialName; + return this; + } + + /** + * Get the privacyRightsRequestEmailAddress property: Privacy rights request email address. + * + * @return the privacyRightsRequestEmailAddress value. + */ + public String privacyRightsRequestEmailAddress() { + return this.privacyRightsRequestEmailAddress; + } + + /** + * Set the privacyRightsRequestEmailAddress property: Privacy rights request email address. + * + * @param privacyRightsRequestEmailAddress the privacyRightsRequestEmailAddress value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withPrivacyRightsRequestEmailAddress(String privacyRightsRequestEmailAddress) { + this.privacyRightsRequestEmailAddress = privacyRightsRequestEmailAddress; + return this; + } + + /** + * Get the privacyPolicyUrl property: URL for the organization's privacy policy. + * + * @return the privacyPolicyUrl value. + */ + public String privacyPolicyUrl() { + return this.privacyPolicyUrl; + } + + /** + * Set the privacyPolicyUrl property: URL for the organization's privacy policy. + * + * @param privacyPolicyUrl the privacyPolicyUrl value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withPrivacyPolicyUrl(String privacyPolicyUrl) { + this.privacyPolicyUrl = privacyPolicyUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model ApplicationProperties")); + } + if (applicationDescription() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property applicationDescription in model ApplicationProperties")); + } + if (category() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property category in model ApplicationProperties")); + } + if (commercialName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property commercialName in model ApplicationProperties")); + } + if (privacyRightsRequestEmailAddress() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property privacyRightsRequestEmailAddress in model ApplicationProperties")); + } + if (privacyPolicyUrl() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property privacyPolicyUrl in model ApplicationProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApplicationProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("applicationDescription", this.applicationDescription); + jsonWriter.writeStringField("category", this.category == null ? null : this.category.toString()); + jsonWriter.writeStringField("commercialName", this.commercialName); + jsonWriter.writeStringField("privacyRightsRequestEmailAddress", this.privacyRightsRequestEmailAddress); + jsonWriter.writeStringField("privacyPolicyUrl", this.privacyPolicyUrl); + 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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 ("category".equals(fieldName)) { + deserializedApplicationProperties.category = Category.fromString(reader.getString()); + } else if ("commercialName".equals(fieldName)) { + deserializedApplicationProperties.commercialName = reader.getString(); + } else if ("privacyRightsRequestEmailAddress".equals(fieldName)) { + deserializedApplicationProperties.privacyRightsRequestEmailAddress = reader.getString(); + } else if ("privacyPolicyUrl".equals(fieldName)) { + deserializedApplicationProperties.privacyPolicyUrl = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedApplicationProperties; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Category.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Category.java new file mode 100644 index 000000000000..1e58c6eee43e --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Category.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Valid values for category based on + * https://www.tmforum.org/oda/open-apis/directory/open-gateway-onboarding-and-ordering-component-suite-TMF931. + */ +public final class Category extends ExpandableStringEnum { + /** + * Static value Agriculture for Category. + */ + public static final Category AGRICULTURE = fromString("Agriculture"); + + /** + * Static value Art and design for Category. + */ + public static final Category ART_AND_DESIGN = fromString("Art and design"); + + /** + * Static value Auto and vehicle for Category. + */ + public static final Category AUTO_AND_VEHICLE = fromString("Auto and vehicle"); + + /** + * Static value Beauty for Category. + */ + public static final Category BEAUTY = fromString("Beauty"); + + /** + * Static value Books and reference for Category. + */ + public static final Category BOOKS_AND_REFERENCE = fromString("Books and reference"); + + /** + * Static value Business for Category. + */ + public static final Category BUSINESS = fromString("Business"); + + /** + * Static value Construction for Category. + */ + public static final Category CONSTRUCTION = fromString("Construction"); + + /** + * Static value Defense for Category. + */ + public static final Category DEFENSE = fromString("Defense"); + + /** + * Static value Developer tools for Category. + */ + public static final Category DEVELOPER_TOOLS = fromString("Developer tools"); + + /** + * Static value Education for Category. + */ + public static final Category EDUCATION = fromString("Education"); + + /** + * Static value Engineering for Category. + */ + public static final Category ENGINEERING = fromString("Engineering"); + + /** + * Static value Events and entertainment for Category. + */ + public static final Category EVENTS_AND_ENTERTAINMENT = fromString("Events and entertainment"); + + /** + * Static value Finance for Category. + */ + public static final Category FINANCE = fromString("Finance"); + + /** + * Static value Food and drink for Category. + */ + public static final Category FOOD_AND_DRINK = fromString("Food and drink"); + + /** + * Static value Games for Category. + */ + public static final Category GAMES = fromString("Games"); + + /** + * Static value Health and fitness for Category. + */ + public static final Category HEALTH_AND_FITNESS = fromString("Health and fitness"); + + /** + * Static value Healthcare for Category. + */ + public static final Category HEALTHCARE = fromString("Healthcare"); + + /** + * Static value Information for Category. + */ + public static final Category INFORMATION = fromString("Information"); + + /** + * Static value Kids for Category. + */ + public static final Category KIDS = fromString("Kids"); + + /** + * Static value Libraries and demo for Category. + */ + public static final Category LIBRARIES_AND_DEMO = fromString("Libraries and demo"); + + /** + * Static value Lifestyle for Category. + */ + public static final Category LIFESTYLE = fromString("Lifestyle"); + + /** + * Static value Manufacturing for Category. + */ + public static final Category MANUFACTURING = fromString("Manufacturing"); + + /** + * Static value Maps and navigation for Category. + */ + public static final Category MAPS_AND_NAVIGATION = fromString("Maps and navigation"); + + /** + * Static value Media for Category. + */ + public static final Category MEDIA = fromString("Media"); + + /** + * Static value Medical for Category. + */ + public static final Category MEDICAL = fromString("Medical"); + + /** + * Static value Mining for Category. + */ + public static final Category MINING = fromString("Mining"); + + /** + * Static value Music and audio for Category. + */ + public static final Category MUSIC_AND_AUDIO = fromString("Music and audio"); + + /** + * Static value News and magazines for Category. + */ + public static final Category NEWS_AND_MAGAZINES = fromString("News and magazines"); + + /** + * Static value Organizations for Category. + */ + public static final Category ORGANIZATIONS = fromString("Organizations"); + + /** + * Static value Other for Category. + */ + public static final Category OTHER = fromString("Other"); + + /** + * Static value Photo and video for Category. + */ + public static final Category PHOTO_AND_VIDEO = fromString("Photo and video"); + + /** + * Static value Productivity for Category. + */ + public static final Category PRODUCTIVITY = fromString("Productivity"); + + /** + * Static value Public service for Category. + */ + public static final Category PUBLIC_SERVICE = fromString("Public service"); + + /** + * Static value Real estate for Category. + */ + public static final Category REAL_ESTATE = fromString("Real estate"); + + /** + * Static value Shopping for Category. + */ + public static final Category SHOPPING = fromString("Shopping"); + + /** + * Static value Social networking and communications for Category. + */ + public static final Category SOCIAL_NETWORKING_AND_COMMUNICATIONS + = fromString("Social networking and communications"); + + /** + * Static value Sports for Category. + */ + public static final Category SPORTS = fromString("Sports"); + + /** + * Static value Tourism for Category. + */ + public static final Category TOURISM = fromString("Tourism"); + + /** + * Static value Utilities for Category. + */ + public static final Category UTILITIES = fromString("Utilities"); + + /** + * Static value Trading for Category. + */ + public static final Category TRADING = fromString("Trading"); + + /** + * Static value Transportation for Category. + */ + public static final Category TRANSPORTATION = fromString("Transportation"); + + /** + * Static value Travel and local for Category. + */ + public static final Category TRAVEL_AND_LOCAL = fromString("Travel and local"); + + /** + * Static value Water for Category. + */ + public static final Category WATER = fromString("Water"); + + /** + * Static value Weather for Category. + */ + public static final Category WEATHER = fromString("Weather"); + + /** + * Creates a new instance of Category value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Category() { + } + + /** + * Creates or finds a Category from its string representation. + * + * @param name a name to look for. + * @return the corresponding Category. + */ + public static Category fromString(String name) { + return fromString(name, Category.class); + } + + /** + * Gets known Category values. + * + * @return known Category values. + */ + public static Collection values() { + return values(Category.class); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Context.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Context.java new file mode 100644 index 000000000000..80f93ba39dcf --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Context.java @@ -0,0 +1,587 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Valid values for the context based on W3C Data Privacy Vocabulary v2 https://w3c.github.io/dpv/2.0/dpv/. + */ +public final class Context extends ExpandableStringEnum { + /** + * Static value Algorithmic logic for Context. + */ + public static final Context ALGORITHMIC_LOGIC = fromString("Algorithmic logic"); + + /** + * Static value Assistive automation for Context. + */ + public static final Context ASSISTIVE_AUTOMATION = fromString("Assistive automation"); + + /** + * Static value Automated decision making for Context. + */ + public static final Context AUTOMATED_DECISION_MAKING = fromString("Automated decision making"); + + /** + * Static value Automated scoring of individuals for Context. + */ + public static final Context AUTOMATED_SCORING_OF_INDIVIDUALS = fromString("Automated scoring of individuals"); + + /** + * Static value Automation level for Context. + */ + public static final Context AUTOMATION_LEVEL = fromString("Automation level"); + + /** + * Static value Autonomous for Context. + */ + public static final Context AUTONOMOUS = fromString("Autonomous"); + + /** + * Static value Cannot challenge process for Context. + */ + public static final Context CANNOT_CHALLENGE_PROCESS = fromString("Cannot challenge process"); + + /** + * Static value Cannot challenge process input for Context. + */ + public static final Context CANNOT_CHALLENGE_PROCESS_INPUT = fromString("Cannot challenge process input"); + + /** + * Static value Cannot challenge process output for Context. + */ + public static final Context CANNOT_CHALLENGE_PROCESS_OUTPUT = fromString("Cannot challenge process output"); + + /** + * Static value Cannot correct process for Context. + */ + public static final Context CANNOT_CORRECT_PROCESS = fromString("Cannot correct process"); + + /** + * Static value Cannot correct process input for Context. + */ + public static final Context CANNOT_CORRECT_PROCESS_INPUT = fromString("Cannot correct process input"); + + /** + * Static value Cannot correct process output for Context. + */ + public static final Context CANNOT_CORRECT_PROCESS_OUTPUT = fromString("Cannot correct process output"); + + /** + * Static value Cannot object to process for Context. + */ + public static final Context CANNOT_OBJECT_TO_PROCESS = fromString("Cannot object to process"); + + /** + * Static value Cannot opt in to process for Context. + */ + public static final Context CANNOT_OPT_IN_TO_PROCESS = fromString("Cannot opt in to process"); + + /** + * Static value Cannot opt out from process for Context. + */ + public static final Context CANNOT_OPT_OUT_FROM_PROCESS = fromString("Cannot opt out from process"); + + /** + * Static value Cannot reverse process effects for Context. + */ + public static final Context CANNOT_REVERSE_PROCESS_EFFECTS = fromString("Cannot reverse process effects"); + + /** + * Static value Cannot reverse process input for Context. + */ + public static final Context CANNOT_REVERSE_PROCESS_INPUT = fromString("Cannot reverse process input"); + + /** + * Static value Cannot reverse process output for Context. + */ + public static final Context CANNOT_REVERSE_PROCESS_OUTPUT = fromString("Cannot reverse process output"); + + /** + * Static value Cannot withdraw from process for Context. + */ + public static final Context CANNOT_WITHDRAW_FROM_PROCESS = fromString("Cannot withdraw from process"); + + /** + * Static value Challenging process for Context. + */ + public static final Context CHALLENGING_PROCESS = fromString("Challenging process"); + + /** + * Static value Challenging process input for Context. + */ + public static final Context CHALLENGING_PROCESS_INPUT = fromString("Challenging process input"); + + /** + * Static value Challenging process output for Context. + */ + public static final Context CHALLENGING_PROCESS_OUTPUT = fromString("Challenging process output"); + + /** + * Static value Conditional automation for Context. + */ + public static final Context CONDITIONAL_AUTOMATION = fromString("Conditional automation"); + + /** + * Static value Consent control for Context. + */ + public static final Context CONSENT_CONTROL = fromString("Consent control"); + + /** + * Static value Correcting process for Context. + */ + public static final Context CORRECTING_PROCESS = fromString("Correcting process"); + + /** + * Static value Correcting process input for Context. + */ + public static final Context CORRECTING_PROCESS_INPUT = fromString("Correcting process input"); + + /** + * Static value Correcting process output for Context. + */ + public static final Context CORRECTING_PROCESS_OUTPUT = fromString("Correcting process output"); + + /** + * Static value Completely manual processing for Context. + */ + public static final Context COMPLETELY_MANUAL_PROCESSING = fromString("Completely manual processing"); + + /** + * Static value Data controller data source for Context. + */ + public static final Context DATA_CONTROLLER_DATA_SOURCE = fromString("Data controller data source"); + + /** + * Static value Data published by data subject for Context. + */ + public static final Context DATA_PUBLISHED_BY_DATA_SUBJECT = fromString("Data published by data subject"); + + /** + * Static value Data source for Context. + */ + public static final Context DATA_SOURCE = fromString("Data source"); + + /** + * Static value Data subject for Context. + */ + public static final Context DATA_SUBJECT = fromString("Data subject"); + + /** + * Static value Data subject data source for Context. + */ + public static final Context DATA_SUBJECT_DATA_SOURCE = fromString("Data subject data source"); + + /** + * Static value Data subject scale for Context. + */ + public static final Context DATA_SUBJECT_SCALE = fromString("Data subject scale"); + + /** + * Static value Data volume for Context. + */ + public static final Context DATA_VOLUME = fromString("Data volume"); + + /** + * Static value Decision making for Context. + */ + public static final Context DECISION_MAKING = fromString("Decision making"); + + /** + * Static value Entity active involvement for Context. + */ + public static final Context ENTITY_ACTIVE_INVOLVEMENT = fromString("Entity active involvement"); + + /** + * Static value Entity involvement for Context. + */ + public static final Context ENTITY_INVOLVEMENT = fromString("Entity involvement"); + + /** + * Static value Entity non involvement for Context. + */ + public static final Context ENTITY_NON_INVOLVEMENT = fromString("Entity non involvement"); + + /** + * Static value Entity non permissive involvement for Context. + */ + public static final Context ENTITY_NON_PERMISSIVE_INVOLVEMENT = fromString("Entity non permissive involvement"); + + /** + * Static value Entity passive involvement for Context. + */ + public static final Context ENTITY_PASSIVE_INVOLVEMENT = fromString("Entity passive involvement"); + + /** + * Static value Entity permissive involvement for Context. + */ + public static final Context ENTITY_PERMISSIVE_INVOLVEMENT = fromString("Entity permissive involvement"); + + /** + * Static value Evaluation of individuals for Context. + */ + public static final Context EVALUATION_OF_INDIVIDUALS = fromString("Evaluation of individuals"); + + /** + * Static value Evaluation scoring for Context. + */ + public static final Context EVALUATION_SCORING = fromString("Evaluation scoring"); + + /** + * Static value Full automation for Context. + */ + public static final Context FULL_AUTOMATION = fromString("Full automation"); + + /** + * Static value Geographic coverage for Context. + */ + public static final Context GEOGRAPHIC_COVERAGE = fromString("Geographic coverage"); + + /** + * Static value Global scale for Context. + */ + public static final Context GLOBAL_SCALE = fromString("Global scale"); + + /** + * Static value High automation for Context. + */ + public static final Context HIGH_AUTOMATION = fromString("High automation"); + + /** + * Static value Huge data volume for Context. + */ + public static final Context HUGE_DATA_VOLUME = fromString("Huge data volume"); + + /** + * Static value Huge scale of data subjects for Context. + */ + public static final Context HUGE_SCALE_OF_DATA_SUBJECTS = fromString("Huge scale of data subjects"); + + /** + * Static value Human involved for Context. + */ + public static final Context HUMAN_INVOLVED = fromString("Human involved"); + + /** + * Static value Human involvement for Context. + */ + public static final Context HUMAN_INVOLVEMENT = fromString("Human involvement"); + + /** + * Static value Human involvement for control for Context. + */ + public static final Context HUMAN_INVOLVEMENT_FOR_CONTROL = fromString("Human involvement for control"); + + /** + * Static value Human involvement for decision for Context. + */ + public static final Context HUMAN_INVOLVEMENT_FOR_DECISION = fromString("Human involvement for decision"); + + /** + * Static value Human involvement for input for Context. + */ + public static final Context HUMAN_INVOLVEMENT_FOR_INPUT = fromString("Human involvement for input"); + + /** + * Static value Human involvement for intervention for Context. + */ + public static final Context HUMAN_INVOLVEMENT_FOR_INTERVENTION = fromString("Human involvement for intervention"); + + /** + * Static value Human involvement for oversight for Context. + */ + public static final Context HUMAN_INVOLVEMENT_FOR_OVERSIGHT = fromString("Human involvement for oversight"); + + /** + * Static value Human involvement for verification for Context. + */ + public static final Context HUMAN_INVOLVEMENT_FOR_VERIFICATION = fromString("Human involvement for verification"); + + /** + * Static value Human not involved for Context. + */ + public static final Context HUMAN_NOT_INVOLVED = fromString("Human not involved"); + + /** + * Static value Innovative use of existing technology for Context. + */ + public static final Context INNOVATIVE_USE_OF_EXISTING_TECHNOLOGY + = fromString("Innovative use of existing technology"); + + /** + * Static value Innovative use of new technologies for Context. + */ + public static final Context INNOVATIVE_USE_OF_NEW_TECHNOLOGIES = fromString("Innovative use of new technologies"); + + /** + * Static value Innovative use of technology for Context. + */ + public static final Context INNOVATIVE_USE_OF_TECHNOLOGY = fromString("Innovative use of technology"); + + /** + * Static value Large data volume for Context. + */ + public static final Context LARGE_DATA_VOLUME = fromString("Large data volume"); + + /** + * Static value Large scale of data subjects for Context. + */ + public static final Context LARGE_SCALE_OF_DATA_SUBJECTS = fromString("Large scale of data subjects"); + + /** + * Static value Large scale processing for Context. + */ + public static final Context LARGE_SCALE_PROCESSING = fromString("Large scale processing"); + + /** + * Static value Local environment scale for Context. + */ + public static final Context LOCAL_ENVIRONMENT_SCALE = fromString("Local environment scale"); + + /** + * Static value Locality scale for Context. + */ + public static final Context LOCALITY_SCALE = fromString("Locality scale"); + + /** + * Static value Medium data volume for Context. + */ + public static final Context MEDIUM_DATA_VOLUME = fromString("Medium data volume"); + + /** + * Static value Medium scale of data subjects for Context. + */ + public static final Context MEDIUM_SCALE_OF_DATA_SUBJECTS = fromString("Medium scale of data subjects"); + + /** + * Static value Medium scale processing for Context. + */ + public static final Context MEDIUM_SCALE_PROCESSING = fromString("Medium scale processing"); + + /** + * Static value Multi national scale for Context. + */ + public static final Context MULTI_NATIONAL_SCALE = fromString("Multi national scale"); + + /** + * Static value National scale for Context. + */ + public static final Context NATIONAL_SCALE = fromString("National scale"); + + /** + * Static value Nearly global scale for Context. + */ + public static final Context NEARLY_GLOBAL_SCALE = fromString("Nearly global scale"); + + /** + * Static value Non public data source for Context. + */ + public static final Context NON_PUBLIC_DATA_SOURCE = fromString("Non public data source"); + + /** + * Static value Not automated for Context. + */ + public static final Context NOT_AUTOMATED = fromString("Not automated"); + + /** + * Static value Objecting to process for Context. + */ + public static final Context OBJECTING_TO_PROCESS = fromString("Objecting to process"); + + /** + * Static value Obtain consent for Context. + */ + public static final Context OBTAIN_CONSENT = fromString("Obtain consent"); + + /** + * Static value Opting in to process for Context. + */ + public static final Context OPTING_IN_TO_PROCESS = fromString("Opting in to process"); + + /** + * Static value Opting out from process for Context. + */ + public static final Context OPTING_OUT_FROM_PROCESS = fromString("Opting out from process"); + + /** + * Static value Partial automation for Context. + */ + public static final Context PARTIAL_AUTOMATION = fromString("Partial automation"); + + /** + * Static value Processing condition for Context. + */ + public static final Context PROCESSING_CONDITION = fromString("Processing condition"); + + /** + * Static value Processing duration for Context. + */ + public static final Context PROCESSING_DURATION = fromString("Processing duration"); + + /** + * Static value Processing location for Context. + */ + public static final Context PROCESSING_LOCATION = fromString("Processing location"); + + /** + * Static value Processing scale for Context. + */ + public static final Context PROCESSING_SCALE = fromString("Processing scale"); + + /** + * Static value Provide consent for Context. + */ + public static final Context PROVIDE_CONSENT = fromString("Provide consent"); + + /** + * Static value Public data source for Context. + */ + public static final Context PUBLIC_DATA_SOURCE = fromString("Public data source"); + + /** + * Static value Reaffirm consent for Context. + */ + public static final Context REAFFIRM_CONSENT = fromString("Reaffirm consent"); + + /** + * Static value Regional scale for Context. + */ + public static final Context REGIONAL_SCALE = fromString("Regional scale"); + + /** + * Static value Reversing process effects for Context. + */ + public static final Context REVERSING_PROCESS_EFFECTS = fromString("Reversing process effects"); + + /** + * Static value Reversing process input for Context. + */ + public static final Context REVERSING_PROCESS_INPUT = fromString("Reversing process input"); + + /** + * Static value Reversing process output for Context. + */ + public static final Context REVERSING_PROCESS_OUTPUT = fromString("Reversing process output"); + + /** + * Static value Scale for Context. + */ + public static final Context SCALE = fromString("Scale"); + + /** + * Static value Scoring of individuals for Context. + */ + public static final Context SCORING_OF_INDIVIDUALS = fromString("Scoring of individuals"); + + /** + * Static value Singular data volume for Context. + */ + public static final Context SINGULAR_DATA_VOLUME = fromString("Singular data volume"); + + /** + * Static value Singular scale of data subjects for Context. + */ + public static final Context SINGULAR_SCALE_OF_DATA_SUBJECTS = fromString("Singular scale of data subjects"); + + /** + * Static value Small data volume for Context. + */ + public static final Context SMALL_DATA_VOLUME = fromString("Small data volume"); + + /** + * Static value Small scale of data subjects for Context. + */ + public static final Context SMALL_SCALE_OF_DATA_SUBJECTS = fromString("Small scale of data subjects"); + + /** + * Static value Small scale processing for Context. + */ + public static final Context SMALL_SCALE_PROCESSING = fromString("Small scale processing"); + + /** + * Static value Sporadic data volume for Context. + */ + public static final Context SPORADIC_DATA_VOLUME = fromString("Sporadic data volume"); + + /** + * Static value Sporadic scale of data subjects for Context. + */ + public static final Context SPORADIC_SCALE_OF_DATA_SUBJECTS = fromString("Sporadic scale of data subjects"); + + /** + * Static value Storage condition for Context. + */ + public static final Context STORAGE_CONDITION = fromString("Storage condition"); + + /** + * Static value Storage deletion for Context. + */ + public static final Context STORAGE_DELETION = fromString("Storage deletion"); + + /** + * Static value Storage duration for Context. + */ + public static final Context STORAGE_DURATION = fromString("Storage duration"); + + /** + * Static value Storage location for Context. + */ + public static final Context STORAGE_LOCATION = fromString("Storage location"); + + /** + * Static value Storage restoration for Context. + */ + public static final Context STORAGE_RESTORATION = fromString("Storage restoration"); + + /** + * Static value Systematic monitoring for Context. + */ + public static final Context SYSTEMATIC_MONITORING = fromString("Systematic monitoring"); + + /** + * Static value Third party data source for Context. + */ + public static final Context THIRD_PARTY_DATA_SOURCE = fromString("Third party data source"); + + /** + * Static value Withdraw consent for Context. + */ + public static final Context WITHDRAW_CONSENT = fromString("Withdraw consent"); + + /** + * Static value Withdrawing from process for Context. + */ + public static final Context WITHDRAWING_FROM_PROCESS = fromString("Withdrawing from process"); + + /** + * Creates a new instance of Context value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Context() { + } + + /** + * Creates or finds a Context from its string representation. + * + * @param name a name to look for. + * @return the corresponding Context. + */ + public static Context fromString(String name) { + return fromString(name, Context.class); + } + + /** + * Gets known Context values. + * + * @return known Context values. + */ + public static Collection values() { + return values(Context.class); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/DataProcessing.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/DataProcessing.java new file mode 100644 index 000000000000..3895fcb545ad --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/DataProcessing.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 java.io.IOException; +import java.util.List; + +/** + * Model defining how received data is processed. + */ +@Fluent +public final class DataProcessing implements JsonSerializable { + /* + * The operation that is performed on the data received. + */ + private ProcessingOperation processingOperation; + + /* + * The contexts in which the data is processed. + */ + private List contexts; + + /* + * The duration or temporal limitation of the data processing. + */ + private DurationModel duration; + + /* + * The frequency of the data processing. + */ + private Frequency frequency; + + /* + * The countries/regions the data transits through. + */ + private List transitRegions; + + /* + * The countries/regions the data is stored in. + */ + private List storageRegions; + + /** + * Creates an instance of DataProcessing class. + */ + public DataProcessing() { + } + + /** + * Get the processingOperation property: The operation that is performed on the data received. + * + * @return the processingOperation value. + */ + public ProcessingOperation processingOperation() { + return this.processingOperation; + } + + /** + * Set the processingOperation property: The operation that is performed on the data received. + * + * @param processingOperation the processingOperation value to set. + * @return the DataProcessing object itself. + */ + public DataProcessing withProcessingOperation(ProcessingOperation processingOperation) { + this.processingOperation = processingOperation; + return this; + } + + /** + * Get the contexts property: The contexts in which the data is processed. + * + * @return the contexts value. + */ + public List contexts() { + return this.contexts; + } + + /** + * Set the contexts property: The contexts in which the data is processed. + * + * @param contexts the contexts value to set. + * @return the DataProcessing object itself. + */ + public DataProcessing withContexts(List contexts) { + this.contexts = contexts; + return this; + } + + /** + * Get the duration property: The duration or temporal limitation of the data processing. + * + * @return the duration value. + */ + public DurationModel duration() { + return this.duration; + } + + /** + * Set the duration property: The duration or temporal limitation of the data processing. + * + * @param duration the duration value to set. + * @return the DataProcessing object itself. + */ + public DataProcessing withDuration(DurationModel duration) { + this.duration = duration; + return this; + } + + /** + * Get the frequency property: The frequency of the data processing. + * + * @return the frequency value. + */ + public Frequency frequency() { + return this.frequency; + } + + /** + * Set the frequency property: The frequency of the data processing. + * + * @param frequency the frequency value to set. + * @return the DataProcessing object itself. + */ + public DataProcessing withFrequency(Frequency frequency) { + this.frequency = frequency; + return this; + } + + /** + * Get the transitRegions property: The countries/regions the data transits through. + * + * @return the transitRegions value. + */ + public List transitRegions() { + return this.transitRegions; + } + + /** + * Set the transitRegions property: The countries/regions the data transits through. + * + * @param transitRegions the transitRegions value to set. + * @return the DataProcessing object itself. + */ + public DataProcessing withTransitRegions(List transitRegions) { + this.transitRegions = transitRegions; + return this; + } + + /** + * Get the storageRegions property: The countries/regions the data is stored in. + * + * @return the storageRegions value. + */ + public List storageRegions() { + return this.storageRegions; + } + + /** + * Set the storageRegions property: The countries/regions the data is stored in. + * + * @param storageRegions the storageRegions value to set. + * @return the DataProcessing object itself. + */ + public DataProcessing withStorageRegions(List storageRegions) { + this.storageRegions = storageRegions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (processingOperation() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property processingOperation in model DataProcessing")); + } + if (contexts() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property contexts in model DataProcessing")); + } + if (duration() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property duration in model DataProcessing")); + } + if (frequency() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property frequency in model DataProcessing")); + } + if (transitRegions() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property transitRegions in model DataProcessing")); + } else { + transitRegions().forEach(e -> e.validate()); + } + if (storageRegions() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property storageRegions in model DataProcessing")); + } else { + storageRegions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DataProcessing.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("processingOperation", + this.processingOperation == null ? null : this.processingOperation.toString()); + jsonWriter.writeArrayField("contexts", this.contexts, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("duration", this.duration == null ? null : this.duration.toString()); + jsonWriter.writeStringField("frequency", this.frequency == null ? null : this.frequency.toString()); + jsonWriter.writeArrayField("transitRegions", this.transitRegions, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("storageRegions", this.storageRegions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataProcessing from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataProcessing 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 DataProcessing. + */ + public static DataProcessing fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataProcessing deserializedDataProcessing = new DataProcessing(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("processingOperation".equals(fieldName)) { + deserializedDataProcessing.processingOperation = ProcessingOperation.fromString(reader.getString()); + } else if ("contexts".equals(fieldName)) { + List contexts = reader.readArray(reader1 -> Context.fromString(reader1.getString())); + deserializedDataProcessing.contexts = contexts; + } else if ("duration".equals(fieldName)) { + deserializedDataProcessing.duration = DurationModel.fromString(reader.getString()); + } else if ("frequency".equals(fieldName)) { + deserializedDataProcessing.frequency = Frequency.fromString(reader.getString()); + } else if ("transitRegions".equals(fieldName)) { + List transitRegions = reader.readArray(reader1 -> DataRegions.fromJson(reader1)); + deserializedDataProcessing.transitRegions = transitRegions; + } else if ("storageRegions".equals(fieldName)) { + List storageRegions = reader.readArray(reader1 -> DataRegions.fromJson(reader1)); + deserializedDataProcessing.storageRegions = storageRegions; + } else { + reader.skipChildren(); + } + } + + return deserializedDataProcessing; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/DataRegions.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/DataRegions.java new file mode 100644 index 000000000000..77cf95394063 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/DataRegions.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 java.io.IOException; + +/** + * Model defining the information required about the countries/regions the data transits through or is stored in. + */ +@Fluent +public final class DataRegions implements JsonSerializable { + /* + * The country code of the country/region the data transits through or is stored in. + */ + private String countryCode; + + /* + * The commercial organization who is managing the data. + */ + private String commercialOrganization; + + /* + * Flag to indicate if commercial activity applies to this data management. + */ + private boolean commercialActivity; + + /* + * URL of the organization or governmental data privacy framework. + */ + private String dataPrivacyFrameworkUrl; + + /** + * Creates an instance of DataRegions class. + */ + public DataRegions() { + } + + /** + * Get the countryCode property: The country code of the country/region the data transits through or is stored in. + * + * @return the countryCode value. + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the countryCode property: The country code of the country/region the data transits through or is stored in. + * + * @param countryCode the countryCode value to set. + * @return the DataRegions object itself. + */ + public DataRegions withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the commercialOrganization property: The commercial organization who is managing the data. + * + * @return the commercialOrganization value. + */ + public String commercialOrganization() { + return this.commercialOrganization; + } + + /** + * Set the commercialOrganization property: The commercial organization who is managing the data. + * + * @param commercialOrganization the commercialOrganization value to set. + * @return the DataRegions object itself. + */ + public DataRegions withCommercialOrganization(String commercialOrganization) { + this.commercialOrganization = commercialOrganization; + return this; + } + + /** + * Get the commercialActivity property: Flag to indicate if commercial activity applies to this data management. + * + * @return the commercialActivity value. + */ + public boolean commercialActivity() { + return this.commercialActivity; + } + + /** + * Set the commercialActivity property: Flag to indicate if commercial activity applies to this data management. + * + * @param commercialActivity the commercialActivity value to set. + * @return the DataRegions object itself. + */ + public DataRegions withCommercialActivity(boolean commercialActivity) { + this.commercialActivity = commercialActivity; + return this; + } + + /** + * Get the dataPrivacyFrameworkUrl property: URL of the organization or governmental data privacy framework. + * + * @return the dataPrivacyFrameworkUrl value. + */ + public String dataPrivacyFrameworkUrl() { + return this.dataPrivacyFrameworkUrl; + } + + /** + * Set the dataPrivacyFrameworkUrl property: URL of the organization or governmental data privacy framework. + * + * @param dataPrivacyFrameworkUrl the dataPrivacyFrameworkUrl value to set. + * @return the DataRegions object itself. + */ + public DataRegions withDataPrivacyFrameworkUrl(String dataPrivacyFrameworkUrl) { + this.dataPrivacyFrameworkUrl = dataPrivacyFrameworkUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (countryCode() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property countryCode in model DataRegions")); + } + if (dataPrivacyFrameworkUrl() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataPrivacyFrameworkUrl in model DataRegions")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DataRegions.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("countryCode", this.countryCode); + jsonWriter.writeBooleanField("commercialActivity", this.commercialActivity); + jsonWriter.writeStringField("dataPrivacyFrameworkUrl", this.dataPrivacyFrameworkUrl); + jsonWriter.writeStringField("commercialOrganization", this.commercialOrganization); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataRegions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataRegions 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 DataRegions. + */ + public static DataRegions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataRegions deserializedDataRegions = new DataRegions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("countryCode".equals(fieldName)) { + deserializedDataRegions.countryCode = reader.getString(); + } else if ("commercialActivity".equals(fieldName)) { + deserializedDataRegions.commercialActivity = reader.getBoolean(); + } else if ("dataPrivacyFrameworkUrl".equals(fieldName)) { + deserializedDataRegions.dataPrivacyFrameworkUrl = reader.getString(); + } else if ("commercialOrganization".equals(fieldName)) { + deserializedDataRegions.commercialOrganization = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDataRegions; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/DurationModel.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/DurationModel.java new file mode 100644 index 000000000000..c5895163bf7e --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/DurationModel.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Valid values for the duration based on W3C Data Privacy Vocabulary v2 https://w3c.github.io/dpv/2.0/dpv/. + */ +public final class DurationModel extends ExpandableStringEnum { + /** + * Static value Endless for DurationModel. + */ + public static final DurationModel ENDLESS_DURATION = fromString("Endless"); + + /** + * Static value Fixed occurrences for DurationModel. + */ + public static final DurationModel FIXED_OCCURRENCES_DURATION = fromString("Fixed occurrences"); + + /** + * Static value Indeterminate for DurationModel. + */ + public static final DurationModel INDETERMINATE_DURATION = fromString("Indeterminate"); + + /** + * Static value Temporal for DurationModel. + */ + public static final DurationModel TEMPORAL_DURATION = fromString("Temporal"); + + /** + * Static value Until event for DurationModel. + */ + public static final DurationModel UNTIL_EVENT_DURATION = fromString("Until event"); + + /** + * Static value Until time for DurationModel. + */ + public static final DurationModel UNTIL_TIME_DURATION = fromString("Until time"); + + /** + * Creates a new instance of DurationModel value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DurationModel() { + } + + /** + * Creates or finds a DurationModel from its string representation. + * + * @param name a name to look for. + * @return the corresponding DurationModel. + */ + public static DurationModel fromString(String name) { + return fromString(name, DurationModel.class); + } + + /** + * Gets known DurationModel values. + * + * @return known DurationModel values. + */ + public static Collection values() { + return values(DurationModel.class); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Frequency.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Frequency.java new file mode 100644 index 000000000000..7a4741ce8d3a --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Frequency.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Valid values for the frequency based on W3C Data Privacy Vocabulary v2 https://w3c.github.io/dpv/2.0/dpv/. + */ +public final class Frequency extends ExpandableStringEnum { + /** + * Static value Continuous for Frequency. + */ + public static final Frequency CONTINUOUS_FREQUENCY = fromString("Continuous"); + + /** + * Static value Often for Frequency. + */ + public static final Frequency OFTEN_FREQUENCY = fromString("Often"); + + /** + * Static value Singular for Frequency. + */ + public static final Frequency SINGULAR_FREQUENCY = fromString("Singular"); + + /** + * Static value Sporadic for Frequency. + */ + public static final Frequency SPORADIC_FREQUENCY = fromString("Sporadic"); + + /** + * Creates a new instance of Frequency value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Frequency() { + } + + /** + * Creates or finds a Frequency from its string representation. + * + * @param name a name to look for. + * @return the corresponding Frequency. + */ + public static Frequency fromString(String name) { + return fromString(name, Frequency.class); + } + + /** + * Gets known Frequency values. + * + * @return known Frequency values. + */ + public static Collection values() { + return values(Frequency.class); + } +} 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..057c71b06a65 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Gateway.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + GatewayProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the 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, DefinitionStages.WithProperties { + /** + * 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); + } + + /** + * The stage of the Gateway definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(GatewayProperties properties); + } + } + + /** + * 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/GatewayProperties.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/GatewayProperties.java new file mode 100644 index 000000000000..49b5207cc89f --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/GatewayProperties.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 java.io.IOException; +import java.util.List; + +/** + * Gateway resource properties. + */ +@Fluent +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 Network API requests to the + * Operators via Azure. + */ + private String gatewayBaseUrl; + + /* + * The status of the last operation on the Gateway resource. + */ + private ProvisioningState provisioningState; + + /* + * Details about the Application that would use the Operator's Network APIs. + */ + private ApplicationProperties configuredApplication; + + /* + * Details about the Organization owning the Application that would use the Operator's Network APIs. + */ + private ApplicationOwnerProperties configuredApplicationOwner; + + /** + * 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 Network API 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; + } + + /** + * 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 GatewayProperties object itself. + */ + public GatewayProperties withConfiguredApplication(ApplicationProperties configuredApplication) { + this.configuredApplication = configuredApplication; + return this; + } + + /** + * Get the configuredApplicationOwner property: Details about the Organization owning the Application that would use + * the Operator's Network APIs. + * + * @return the configuredApplicationOwner value. + */ + public ApplicationOwnerProperties configuredApplicationOwner() { + return this.configuredApplicationOwner; + } + + /** + * Set the configuredApplicationOwner property: Details about the Organization owning the Application that would use + * the Operator's Network APIs. + * + * @param configuredApplicationOwner the configuredApplicationOwner value to set. + * @return the GatewayProperties object itself. + */ + public GatewayProperties withConfiguredApplicationOwner(ApplicationOwnerProperties configuredApplicationOwner) { + this.configuredApplicationOwner = configuredApplicationOwner; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (configuredApplication() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property configuredApplication in model GatewayProperties")); + } else { + configuredApplication().validate(); + } + if (configuredApplicationOwner() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property configuredApplicationOwner in model GatewayProperties")); + } else { + configuredApplicationOwner().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GatewayProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("configuredApplication", this.configuredApplication); + jsonWriter.writeJsonField("configuredApplicationOwner", this.configuredApplicationOwner); + 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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 ("configuredApplication".equals(fieldName)) { + deserializedGatewayProperties.configuredApplication = ApplicationProperties.fromJson(reader); + } else if ("configuredApplicationOwner".equals(fieldName)) { + deserializedGatewayProperties.configuredApplicationOwner + = ApplicationOwnerProperties.fromJson(reader); + } else 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/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..8b4b9e08fae8 --- /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) TypeSpec 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..9cc272ead7af --- /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) TypeSpec 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 { + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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/GeographicAddress.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/GeographicAddress.java new file mode 100644 index 000000000000..2c7ae5e75ba0 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/GeographicAddress.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 java.io.IOException; + +/** + * Model defining a geographic address. + */ +@Fluent +public final class GeographicAddress implements JsonSerializable { + /* + * Street Number of the address. + */ + private String streetNumber; + + /* + * Street Name of the address. + */ + private String streetName; + + /* + * Locality of the address. + */ + private String locality; + + /* + * City of the address. + */ + private String city; + + /* + * State or province of the address. + */ + private String stateOrProvince; + + /* + * Postal code of the address. + */ + private String postalCode; + + /* + * Country code of the address. + */ + private String countryCode; + + /** + * Creates an instance of GeographicAddress class. + */ + public GeographicAddress() { + } + + /** + * Get the streetNumber property: Street Number of the address. + * + * @return the streetNumber value. + */ + public String streetNumber() { + return this.streetNumber; + } + + /** + * Set the streetNumber property: Street Number of the address. + * + * @param streetNumber the streetNumber value to set. + * @return the GeographicAddress object itself. + */ + public GeographicAddress withStreetNumber(String streetNumber) { + this.streetNumber = streetNumber; + return this; + } + + /** + * Get the streetName property: Street Name of the address. + * + * @return the streetName value. + */ + public String streetName() { + return this.streetName; + } + + /** + * Set the streetName property: Street Name of the address. + * + * @param streetName the streetName value to set. + * @return the GeographicAddress object itself. + */ + public GeographicAddress withStreetName(String streetName) { + this.streetName = streetName; + return this; + } + + /** + * Get the locality property: Locality of the address. + * + * @return the locality value. + */ + public String locality() { + return this.locality; + } + + /** + * Set the locality property: Locality of the address. + * + * @param locality the locality value to set. + * @return the GeographicAddress object itself. + */ + public GeographicAddress withLocality(String locality) { + this.locality = locality; + return this; + } + + /** + * Get the city property: City of the address. + * + * @return the city value. + */ + public String city() { + return this.city; + } + + /** + * Set the city property: City of the address. + * + * @param city the city value to set. + * @return the GeographicAddress object itself. + */ + public GeographicAddress withCity(String city) { + this.city = city; + return this; + } + + /** + * Get the stateOrProvince property: State or province of the address. + * + * @return the stateOrProvince value. + */ + public String stateOrProvince() { + return this.stateOrProvince; + } + + /** + * Set the stateOrProvince property: State or province of the address. + * + * @param stateOrProvince the stateOrProvince value to set. + * @return the GeographicAddress object itself. + */ + public GeographicAddress withStateOrProvince(String stateOrProvince) { + this.stateOrProvince = stateOrProvince; + return this; + } + + /** + * Get the postalCode property: Postal code of the address. + * + * @return the postalCode value. + */ + public String postalCode() { + return this.postalCode; + } + + /** + * Set the postalCode property: Postal code of the address. + * + * @param postalCode the postalCode value to set. + * @return the GeographicAddress object itself. + */ + public GeographicAddress withPostalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * Get the countryCode property: Country code of the address. + * + * @return the countryCode value. + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the countryCode property: Country code of the address. + * + * @param countryCode the countryCode value to set. + * @return the GeographicAddress object itself. + */ + public GeographicAddress withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (countryCode() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property countryCode in model GeographicAddress")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GeographicAddress.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("countryCode", this.countryCode); + jsonWriter.writeStringField("streetNumber", this.streetNumber); + jsonWriter.writeStringField("streetName", this.streetName); + jsonWriter.writeStringField("locality", this.locality); + jsonWriter.writeStringField("city", this.city); + jsonWriter.writeStringField("stateOrProvince", this.stateOrProvince); + jsonWriter.writeStringField("postalCode", this.postalCode); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GeographicAddress from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GeographicAddress 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 GeographicAddress. + */ + public static GeographicAddress fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GeographicAddress deserializedGeographicAddress = new GeographicAddress(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("countryCode".equals(fieldName)) { + deserializedGeographicAddress.countryCode = reader.getString(); + } else if ("streetNumber".equals(fieldName)) { + deserializedGeographicAddress.streetNumber = reader.getString(); + } else if ("streetName".equals(fieldName)) { + deserializedGeographicAddress.streetName = reader.getString(); + } else if ("locality".equals(fieldName)) { + deserializedGeographicAddress.locality = reader.getString(); + } else if ("city".equals(fieldName)) { + deserializedGeographicAddress.city = reader.getString(); + } else if ("stateOrProvince".equals(fieldName)) { + deserializedGeographicAddress.stateOrProvince = reader.getString(); + } else if ("postalCode".equals(fieldName)) { + deserializedGeographicAddress.postalCode = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGeographicAddress; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/LocalRepresentative.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/LocalRepresentative.java new file mode 100644 index 000000000000..c695a7d131ac --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/LocalRepresentative.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 java.io.IOException; + +/** + * Model defining a local representative for a country/region. + */ +@Fluent +public final class LocalRepresentative implements JsonSerializable { + /* + * Country code for the country/region the local representative is representing. + */ + private String countryCode; + + /* + * Local representative for this country/region. + */ + private Person representative; + + /** + * Creates an instance of LocalRepresentative class. + */ + public LocalRepresentative() { + } + + /** + * Get the countryCode property: Country code for the country/region the local representative is representing. + * + * @return the countryCode value. + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the countryCode property: Country code for the country/region the local representative is representing. + * + * @param countryCode the countryCode value to set. + * @return the LocalRepresentative object itself. + */ + public LocalRepresentative withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the representative property: Local representative for this country/region. + * + * @return the representative value. + */ + public Person representative() { + return this.representative; + } + + /** + * Set the representative property: Local representative for this country/region. + * + * @param representative the representative value to set. + * @return the LocalRepresentative object itself. + */ + public LocalRepresentative withRepresentative(Person representative) { + this.representative = representative; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (countryCode() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property countryCode in model LocalRepresentative")); + } + if (representative() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property representative in model LocalRepresentative")); + } else { + representative().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LocalRepresentative.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("countryCode", this.countryCode); + jsonWriter.writeJsonField("representative", this.representative); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LocalRepresentative from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LocalRepresentative 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 LocalRepresentative. + */ + public static LocalRepresentative fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LocalRepresentative deserializedLocalRepresentative = new LocalRepresentative(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("countryCode".equals(fieldName)) { + deserializedLocalRepresentative.countryCode = reader.getString(); + } else if ("representative".equals(fieldName)) { + deserializedLocalRepresentative.representative = Person.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLocalRepresentative; + }); + } +} 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..1084212a3807 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/MarketplaceProperties.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import java.util.List; + +/** + * Azure marketplace properties for a plan. + */ +@Immutable +public final class MarketplaceProperties implements JsonSerializable { + /* + * Azure marketplace Offer ID for this plan. + */ + private String offerId; + + /* + * Azure marketplace Publisher ID for this plan. + */ + private String publisherId; + + /* + * Azure marketplace Plan ID for this plan. + */ + private String planId; + + /* + * Links to the Terms and Conditions of the Plan that must be accepted to create an + * associated Operator Api Connection + */ + private List planTermsAndConditionsLinks; + + /** + * Creates an instance of MarketplaceProperties class. + */ + private MarketplaceProperties() { + } + + /** + * Get the offerId property: Azure marketplace Offer ID for this plan. + * + * @return the offerId value. + */ + public String offerId() { + return this.offerId; + } + + /** + * Get the publisherId property: Azure marketplace Publisher ID for this plan. + * + * @return the publisherId value. + */ + public String publisherId() { + return this.publisherId; + } + + /** + * Get the planId property: Azure marketplace Plan ID for this plan. + * + * @return the planId value. + */ + public String planId() { + return this.planId; + } + + /** + * Get the planTermsAndConditionsLinks property: Links to the Terms and Conditions of the Plan that must be accepted + * to create an + * associated Operator Api Connection. + * + * @return the planTermsAndConditionsLinks value. + */ + public List planTermsAndConditionsLinks() { + return this.planTermsAndConditionsLinks; + } + + /** + * 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("publisherId", this.publisherId); + jsonWriter.writeStringField("planId", this.planId); + 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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 ("planTermsAndConditionsLinks".equals(fieldName)) { + List planTermsAndConditionsLinks = reader.readArray(reader1 -> reader1.getString()); + deserializedMarketplaceProperties.planTermsAndConditionsLinks = planTermsAndConditionsLinks; + } else if ("offerId".equals(fieldName)) { + deserializedMarketplaceProperties.offerId = reader.getString(); + } else if ("publisherId".equals(fieldName)) { + deserializedMarketplaceProperties.publisherId = reader.getString(); + } else if ("planId".equals(fieldName)) { + deserializedMarketplaceProperties.planId = 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..790dfebe78f1 --- /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) TypeSpec 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 Azure Resource Manager/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: Extensible 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..4e82d5b3b14b --- /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) TypeSpec 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 and 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. + */ + private 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/Operations.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Operations.java new file mode 100644 index 000000000000..3dbcfe4534f3 --- /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) TypeSpec 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..e5c5e682bea7 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnection.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + OperatorApiConnectionProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the 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.WithProperties { + /** + * 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 properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(OperatorApiConnectionProperties properties); + } + } + + /** + * 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.WithProperties { + /** + * 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 properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(OperatorApiConnectionUpdateProperties properties); + } + } + + /** + * 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/OperatorApiConnectionProperties.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnectionProperties.java new file mode 100644 index 000000000000..34205c9fbc8c --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnectionProperties.java @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 java.io.IOException; +import java.util.List; + +/** + * 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; + + /* + * Reference to the APC Gateway resource ID. + */ + private String gatewayId; + + /* + * 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; + + /* + * Whether the caller has accepted the Terms and Conditions of the associated Operator API Plan. + * After creation, the planTermsAndConditionsLink property is set to the Terms and Conditions that + * have been accepted. + * + * Must be set to True, as the Terms and Conditions must be accepted. + */ + private boolean planTermsAndConditionsAccepted; + + /* + * Links to the Terms and Conditions of the Operator API Plan that were accepted on creation. + */ + private List planTermsAndConditionsLinks; + + /* + * The purpose for which the Application will use the API. Max Items 1 currently as Operators do not support + * multiple. + */ + private List purposes; + + /* + * Explanation of the reason that justifies the purpose: specifically why is the API used for the application's use + * case. + */ + private String purposeReason; + + /* + * List of ways the data returned on this API is processed. + */ + private List dataProcessingList; + + /** + * 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 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 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; + } + + /** + * Get the planTermsAndConditionsAccepted property: Whether the caller has accepted the Terms and Conditions of the + * associated Operator API Plan. + * After creation, the planTermsAndConditionsLink property is set to the Terms and Conditions that + * have been accepted. + * + * Must be set to True, as the Terms and Conditions must be accepted. + * + * @return the planTermsAndConditionsAccepted value. + */ + public boolean planTermsAndConditionsAccepted() { + return this.planTermsAndConditionsAccepted; + } + + /** + * Set the planTermsAndConditionsAccepted property: Whether the caller has accepted the Terms and Conditions of the + * associated Operator API Plan. + * After creation, the planTermsAndConditionsLink property is set to the Terms and Conditions that + * have been accepted. + * + * Must be set to True, as the Terms and Conditions must be accepted. + * + * @param planTermsAndConditionsAccepted the planTermsAndConditionsAccepted value to set. + * @return the OperatorApiConnectionProperties object itself. + */ + public OperatorApiConnectionProperties withPlanTermsAndConditionsAccepted(boolean planTermsAndConditionsAccepted) { + this.planTermsAndConditionsAccepted = planTermsAndConditionsAccepted; + return this; + } + + /** + * Get the planTermsAndConditionsLinks property: Links to the Terms and Conditions of the Operator API Plan that + * were accepted on creation. + * + * @return the planTermsAndConditionsLinks value. + */ + public List planTermsAndConditionsLinks() { + return this.planTermsAndConditionsLinks; + } + + /** + * Get the purposes property: The purpose for which the Application will use the API. Max Items 1 currently as + * Operators do not support multiple. + * + * @return the purposes value. + */ + public List purposes() { + return this.purposes; + } + + /** + * Set the purposes property: The purpose for which the Application will use the API. Max Items 1 currently as + * Operators do not support multiple. + * + * @param purposes the purposes value to set. + * @return the OperatorApiConnectionProperties object itself. + */ + public OperatorApiConnectionProperties withPurposes(List purposes) { + this.purposes = purposes; + return this; + } + + /** + * Get the purposeReason property: Explanation of the reason that justifies the purpose: specifically why is the API + * used for the application's use case. + * + * @return the purposeReason value. + */ + public String purposeReason() { + return this.purposeReason; + } + + /** + * Set the purposeReason property: Explanation of the reason that justifies the purpose: specifically why is the API + * used for the application's use case. + * + * @param purposeReason the purposeReason value to set. + * @return the OperatorApiConnectionProperties object itself. + */ + public OperatorApiConnectionProperties withPurposeReason(String purposeReason) { + this.purposeReason = purposeReason; + return this; + } + + /** + * Get the dataProcessingList property: List of ways the data returned on this API is processed. + * + * @return the dataProcessingList value. + */ + public List dataProcessingList() { + return this.dataProcessingList; + } + + /** + * Set the dataProcessingList property: List of ways the data returned on this API is processed. + * + * @param dataProcessingList the dataProcessingList value to set. + * @return the OperatorApiConnectionProperties object itself. + */ + public OperatorApiConnectionProperties withDataProcessingList(List dataProcessingList) { + this.dataProcessingList = dataProcessingList; + return this; + } + + /** + * 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 (gatewayId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property gatewayId in model OperatorApiConnectionProperties")); + } + if (status() != null) { + status().validate(); + } + if (purposes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property purposes in model OperatorApiConnectionProperties")); + } + if (purposeReason() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property purposeReason in model OperatorApiConnectionProperties")); + } + if (dataProcessingList() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataProcessingList in model OperatorApiConnectionProperties")); + } else { + dataProcessingList().forEach(e -> e.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.writeBooleanField("planTermsAndConditionsAccepted", this.planTermsAndConditionsAccepted); + jsonWriter.writeArrayField("purposes", this.purposes, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("purposeReason", this.purposeReason); + jsonWriter.writeArrayField("dataProcessingList", this.dataProcessingList, + (writer, element) -> writer.writeJson(element)); + 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 ("planTermsAndConditionsAccepted".equals(fieldName)) { + deserializedOperatorApiConnectionProperties.planTermsAndConditionsAccepted = reader.getBoolean(); + } else if ("purposes".equals(fieldName)) { + List purposes = reader.readArray(reader1 -> Purpose.fromString(reader1.getString())); + deserializedOperatorApiConnectionProperties.purposes = purposes; + } else if ("purposeReason".equals(fieldName)) { + deserializedOperatorApiConnectionProperties.purposeReason = reader.getString(); + } else if ("dataProcessingList".equals(fieldName)) { + List dataProcessingList + = reader.readArray(reader1 -> DataProcessing.fromJson(reader1)); + deserializedOperatorApiConnectionProperties.dataProcessingList = dataProcessingList; + } 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 if ("planTermsAndConditionsLinks".equals(fieldName)) { + List planTermsAndConditionsLinks = reader.readArray(reader1 -> reader1.getString()); + deserializedOperatorApiConnectionProperties.planTermsAndConditionsLinks + = planTermsAndConditionsLinks; + } else { + reader.skipChildren(); + } + } + + return deserializedOperatorApiConnectionProperties; + }); + } +} 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..d7a83ea192e8 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnectionUpdate.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 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 properties; + + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public OperatorApiConnectionUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the OperatorApiConnectionUpdate object itself. + */ + public OperatorApiConnectionUpdate withProperties(OperatorApiConnectionUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().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.properties); + 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.properties + = OperatorApiConnectionUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperatorApiConnectionUpdate; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnectionUpdateProperties.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnectionUpdateProperties.java new file mode 100644 index 000000000000..ea73c743d10c --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiConnectionUpdateProperties.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.List; + +/** + * The updatable properties of the OperatorApiConnection. + */ +@Fluent +public final class OperatorApiConnectionUpdateProperties + implements JsonSerializable { + /* + * Reference to the Operator API Plan Resource ID. + */ + private String operatorApiPlanId; + + /* + * Whether the caller has accepted the Terms and Conditions of the associated Operator API Plan. + * After creation, the planTermsAndConditionsLink property is set to the Terms and Conditions that + * have been accepted. + * + * Must be set to True, as the Terms and Conditions must be accepted. + */ + private Boolean planTermsAndConditionsAccepted; + + /* + * The purpose for which the Application will use the API. Max Items 1 currently as Operators do not support + * multiple. + */ + private List purposes; + + /* + * Explanation of the reason that justifies the purpose: specifically why is the API used for the application's use + * case. + */ + private String purposeReason; + + /* + * List of ways the data returned on this API is processed. + */ + private List dataProcessingList; + + /** + * 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 planTermsAndConditionsAccepted property: Whether the caller has accepted the Terms and Conditions of the + * associated Operator API Plan. + * After creation, the planTermsAndConditionsLink property is set to the Terms and Conditions that + * have been accepted. + * + * Must be set to True, as the Terms and Conditions must be accepted. + * + * @return the planTermsAndConditionsAccepted value. + */ + public Boolean planTermsAndConditionsAccepted() { + return this.planTermsAndConditionsAccepted; + } + + /** + * Set the planTermsAndConditionsAccepted property: Whether the caller has accepted the Terms and Conditions of the + * associated Operator API Plan. + * After creation, the planTermsAndConditionsLink property is set to the Terms and Conditions that + * have been accepted. + * + * Must be set to True, as the Terms and Conditions must be accepted. + * + * @param planTermsAndConditionsAccepted the planTermsAndConditionsAccepted value to set. + * @return the OperatorApiConnectionUpdateProperties object itself. + */ + public OperatorApiConnectionUpdateProperties + withPlanTermsAndConditionsAccepted(Boolean planTermsAndConditionsAccepted) { + this.planTermsAndConditionsAccepted = planTermsAndConditionsAccepted; + return this; + } + + /** + * Get the purposes property: The purpose for which the Application will use the API. Max Items 1 currently as + * Operators do not support multiple. + * + * @return the purposes value. + */ + public List purposes() { + return this.purposes; + } + + /** + * Set the purposes property: The purpose for which the Application will use the API. Max Items 1 currently as + * Operators do not support multiple. + * + * @param purposes the purposes value to set. + * @return the OperatorApiConnectionUpdateProperties object itself. + */ + public OperatorApiConnectionUpdateProperties withPurposes(List purposes) { + this.purposes = purposes; + return this; + } + + /** + * Get the purposeReason property: Explanation of the reason that justifies the purpose: specifically why is the API + * used for the application's use case. + * + * @return the purposeReason value. + */ + public String purposeReason() { + return this.purposeReason; + } + + /** + * Set the purposeReason property: Explanation of the reason that justifies the purpose: specifically why is the API + * used for the application's use case. + * + * @param purposeReason the purposeReason value to set. + * @return the OperatorApiConnectionUpdateProperties object itself. + */ + public OperatorApiConnectionUpdateProperties withPurposeReason(String purposeReason) { + this.purposeReason = purposeReason; + return this; + } + + /** + * Get the dataProcessingList property: List of ways the data returned on this API is processed. + * + * @return the dataProcessingList value. + */ + public List dataProcessingList() { + return this.dataProcessingList; + } + + /** + * Set the dataProcessingList property: List of ways the data returned on this API is processed. + * + * @param dataProcessingList the dataProcessingList value to set. + * @return the OperatorApiConnectionUpdateProperties object itself. + */ + public OperatorApiConnectionUpdateProperties withDataProcessingList(List dataProcessingList) { + this.dataProcessingList = dataProcessingList; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dataProcessingList() != null) { + dataProcessingList().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("operatorApiPlanId", this.operatorApiPlanId); + jsonWriter.writeBooleanField("planTermsAndConditionsAccepted", this.planTermsAndConditionsAccepted); + jsonWriter.writeArrayField("purposes", this.purposes, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("purposeReason", this.purposeReason); + jsonWriter.writeArrayField("dataProcessingList", this.dataProcessingList, + (writer, element) -> writer.writeJson(element)); + 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 ("planTermsAndConditionsAccepted".equals(fieldName)) { + deserializedOperatorApiConnectionUpdateProperties.planTermsAndConditionsAccepted + = reader.getNullable(JsonReader::getBoolean); + } else if ("purposes".equals(fieldName)) { + List purposes = reader.readArray(reader1 -> Purpose.fromString(reader1.getString())); + deserializedOperatorApiConnectionUpdateProperties.purposes = purposes; + } else if ("purposeReason".equals(fieldName)) { + deserializedOperatorApiConnectionUpdateProperties.purposeReason = reader.getString(); + } else if ("dataProcessingList".equals(fieldName)) { + List dataProcessingList + = reader.readArray(reader1 -> DataProcessing.fromJson(reader1)); + deserializedOperatorApiConnectionUpdateProperties.dataProcessingList = dataProcessingList; + } else { + reader.skipChildren(); + } + } + + return deserializedOperatorApiConnectionUpdateProperties; + }); + } +} 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..15686c01fed0 --- /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) TypeSpec 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 { + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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..7799a0abcd6d --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiPlan.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiPlanInner; + +/** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + OperatorApiPlanProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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/OperatorApiPlanProperties.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiPlanProperties.java new file mode 100644 index 000000000000..31ff6414724f --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OperatorApiPlanProperties.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import java.util.List; + +/** + * Operator API Plan properties. + */ +@Immutable +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. + */ + private OperatorApiPlanProperties() { + } + + /** + * Get the operatorName property: Name of the Operator this plan belongs to. + * + * @return the operatorName value. + */ + public String operatorName() { + return this.operatorName; + } + + /** + * Get the camaraApiName property: Standardized Network API name defined by CAMARA specifications. + * + * @return the camaraApiName value. + */ + public String camaraApiName() { + return this.camaraApiName; + } + + /** + * Get the supportedLocations property: List of Azure regions where this offer is supported. + * + * @return the supportedLocations value. + */ + public List supportedLocations() { + return this.supportedLocations; + } + + /** + * 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; + } + + /** + * 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; + } + + /** + * Get the limits property: The limits, if any, will be imposed by the operator. + * + * @return the limits value. + */ + public String limits() { + return this.limits; + } + + /** + * Get the marketplaceProperties property: Azure marketplace properties for this plan. + * + * @return the marketplaceProperties value. + */ + public MarketplaceProperties marketplaceProperties() { + return this.marketplaceProperties; + } + + /** + * 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/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..eeda6d09f91c --- /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) TypeSpec 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 { + /** + * 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); + + /** + * 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); +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OrganizationType.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OrganizationType.java new file mode 100644 index 000000000000..bc6b37210ff0 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/OrganizationType.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Valid values for the Organization Type based on W3C Data Privacy Vocabulary v2 https://w3c.github.io/dpv/2.0/dpv/. + */ +public final class OrganizationType extends ExpandableStringEnum { + /** + * Static value Academic scientific organization for OrganizationType. + */ + public static final OrganizationType ACADEMIC_SCIENTIFIC_ORGANIZATION + = fromString("Academic scientific organization"); + + /** + * Static value For profit organization for OrganizationType. + */ + public static final OrganizationType FOR_PROFIT_ORGANIZATION = fromString("For profit organization"); + + /** + * Static value Governmental organization for OrganizationType. + */ + public static final OrganizationType GOVERNMENTAL_ORGANIZATION = fromString("Governmental organization"); + + /** + * Static value Industry consortium for OrganizationType. + */ + public static final OrganizationType INDUSTRY_CONSORTIUM = fromString("Industry consortium"); + + /** + * Static value International organization for OrganizationType. + */ + public static final OrganizationType INTERNATIONAL_ORGANIZATION = fromString("International organization"); + + /** + * Static value Non-governmental organization for OrganizationType. + */ + public static final OrganizationType NON_GOVERNMENTAL_ORGANIZATION = fromString("Non-governmental organization"); + + /** + * Static value Non-profit organization for OrganizationType. + */ + public static final OrganizationType NON_PROFIT_ORGANIZATION = fromString("Non-profit organization"); + + /** + * Static value Organizational unit for OrganizationType. + */ + public static final OrganizationType ORGANIZATIONAL_UNIT = fromString("Organizational unit"); + + /** + * Creates a new instance of OrganizationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OrganizationType() { + } + + /** + * Creates or finds a OrganizationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OrganizationType. + */ + public static OrganizationType fromString(String name) { + return fromString(name, OrganizationType.class); + } + + /** + * Gets known OrganizationType values. + * + * @return known OrganizationType values. + */ + public static Collection values() { + return values(OrganizationType.class); + } +} 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..dd32b8961baa --- /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) TypeSpec 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 { + /** + * Indicates the operation is initiated by a user. + */ + public static final Origin USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + 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/Person.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Person.java new file mode 100644 index 000000000000..7d66c67ba57c --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Person.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 java.io.IOException; + +/** + * Model defining a contactable person. + */ +@Fluent +public final class Person implements JsonSerializable { + /* + * Family name of the contactable person. + */ + private String familyName; + + /* + * Given name of the contactable person. + */ + private String givenName; + + /* + * Email address of the contactable person. + */ + private String emailAddress; + + /** + * Creates an instance of Person class. + */ + public Person() { + } + + /** + * Get the familyName property: Family name of the contactable person. + * + * @return the familyName value. + */ + public String familyName() { + return this.familyName; + } + + /** + * Set the familyName property: Family name of the contactable person. + * + * @param familyName the familyName value to set. + * @return the Person object itself. + */ + public Person withFamilyName(String familyName) { + this.familyName = familyName; + return this; + } + + /** + * Get the givenName property: Given name of the contactable person. + * + * @return the givenName value. + */ + public String givenName() { + return this.givenName; + } + + /** + * Set the givenName property: Given name of the contactable person. + * + * @param givenName the givenName value to set. + * @return the Person object itself. + */ + public Person withGivenName(String givenName) { + this.givenName = givenName; + return this; + } + + /** + * Get the emailAddress property: Email address of the contactable person. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the emailAddress property: Email address of the contactable person. + * + * @param emailAddress the emailAddress value to set. + * @return the Person object itself. + */ + public Person withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (familyName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property familyName in model Person")); + } + if (givenName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property givenName in model Person")); + } + if (emailAddress() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property emailAddress in model Person")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Person.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("familyName", this.familyName); + jsonWriter.writeStringField("givenName", this.givenName); + jsonWriter.writeStringField("emailAddress", this.emailAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Person from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Person 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 Person. + */ + public static Person fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Person deserializedPerson = new Person(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("familyName".equals(fieldName)) { + deserializedPerson.familyName = reader.getString(); + } else if ("givenName".equals(fieldName)) { + deserializedPerson.givenName = reader.getString(); + } else if ("emailAddress".equals(fieldName)) { + deserializedPerson.emailAddress = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPerson; + }); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ProcessingOperation.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ProcessingOperation.java new file mode 100644 index 000000000000..2e896be1ec78 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/ProcessingOperation.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Valid values for the processing operation based on W3C Data Privacy Vocabulary v2 https://w3c.github.io/dpv/2.0/dpv/. + */ +public final class ProcessingOperation extends ExpandableStringEnum { + /** + * Static value Access for ProcessingOperation. + */ + public static final ProcessingOperation ACCESS = fromString("Access"); + + /** + * Static value Acquire for ProcessingOperation. + */ + public static final ProcessingOperation ACQUIRE = fromString("Acquire"); + + /** + * Static value Adapt for ProcessingOperation. + */ + public static final ProcessingOperation ADAPT = fromString("Adapt"); + + /** + * Static value Aggregate for ProcessingOperation. + */ + public static final ProcessingOperation AGGREGATE = fromString("Aggregate"); + + /** + * Static value Align for ProcessingOperation. + */ + public static final ProcessingOperation ALIGN = fromString("Align"); + + /** + * Static value Alter for ProcessingOperation. + */ + public static final ProcessingOperation ALTER = fromString("Alter"); + + /** + * Static value Analyze for ProcessingOperation. + */ + public static final ProcessingOperation ANALYZE = fromString("Analyze"); + + /** + * Static value Anonymize for ProcessingOperation. + */ + public static final ProcessingOperation ANONYMIZE = fromString("Anonymize"); + + /** + * Static value Assess for ProcessingOperation. + */ + public static final ProcessingOperation ASSESS = fromString("Assess"); + + /** + * Static value Collect for ProcessingOperation. + */ + public static final ProcessingOperation COLLECT = fromString("Collect"); + + /** + * Static value Combine for ProcessingOperation. + */ + public static final ProcessingOperation COMBINE = fromString("Combine"); + + /** + * Static value Consult for ProcessingOperation. + */ + public static final ProcessingOperation CONSULT = fromString("Consult"); + + /** + * Static value Copy for ProcessingOperation. + */ + public static final ProcessingOperation COPY = fromString("Copy"); + + /** + * Static value Cross border transfer for ProcessingOperation. + */ + public static final ProcessingOperation CROSS_BORDER_TRANSFER = fromString("Cross border transfer"); + + /** + * Static value Delete for ProcessingOperation. + */ + public static final ProcessingOperation DELETE = fromString("Delete"); + + /** + * Static value Derive for ProcessingOperation. + */ + public static final ProcessingOperation DERIVE = fromString("Derive"); + + /** + * Static value Destruct for ProcessingOperation. + */ + public static final ProcessingOperation DESTRUCT = fromString("Destruct"); + + /** + * Static value Disclose for ProcessingOperation. + */ + public static final ProcessingOperation DISCLOSE = fromString("Disclose"); + + /** + * Static value Disclose by transmission for ProcessingOperation. + */ + public static final ProcessingOperation DISCLOSE_BY_TRANSMISSION = fromString("Disclose by transmission"); + + /** + * Static value Display for ProcessingOperation. + */ + public static final ProcessingOperation DISPLAY = fromString("Display"); + + /** + * Static value Disseminate for ProcessingOperation. + */ + public static final ProcessingOperation DISSEMINATE = fromString("Disseminate"); + + /** + * Static value Download for ProcessingOperation. + */ + public static final ProcessingOperation DOWNLOAD = fromString("Download"); + + /** + * Static value Erase for ProcessingOperation. + */ + public static final ProcessingOperation ERASE = fromString("Erase"); + + /** + * Static value Export for ProcessingOperation. + */ + public static final ProcessingOperation EXPORT = fromString("Export"); + + /** + * Static value Filter for ProcessingOperation. + */ + public static final ProcessingOperation FILTER = fromString("Filter"); + + /** + * Static value Format for ProcessingOperation. + */ + public static final ProcessingOperation FORMAT = fromString("Format"); + + /** + * Static value Generate for ProcessingOperation. + */ + public static final ProcessingOperation GENERATE = fromString("Generate"); + + /** + * Static value Infer for ProcessingOperation. + */ + public static final ProcessingOperation INFER = fromString("Infer"); + + /** + * Static value Make available for ProcessingOperation. + */ + public static final ProcessingOperation MAKE_AVAILABLE = fromString("Make available"); + + /** + * Static value Match for ProcessingOperation. + */ + public static final ProcessingOperation MATCH = fromString("Match"); + + /** + * Static value Modify for ProcessingOperation. + */ + public static final ProcessingOperation MODIFY = fromString("Modify"); + + /** + * Static value Monitor for ProcessingOperation. + */ + public static final ProcessingOperation MONITOR = fromString("Monitor"); + + /** + * Static value Move for ProcessingOperation. + */ + public static final ProcessingOperation MOVE = fromString("Move"); + + /** + * Static value Observe for ProcessingOperation. + */ + public static final ProcessingOperation OBSERVE = fromString("Observe"); + + /** + * Static value Obtain for ProcessingOperation. + */ + public static final ProcessingOperation OBTAIN = fromString("Obtain"); + + /** + * Static value Organize for ProcessingOperation. + */ + public static final ProcessingOperation ORGANIZE = fromString("Organize"); + + /** + * Static value Profiling for ProcessingOperation. + */ + public static final ProcessingOperation PROFILING = fromString("Profiling"); + + /** + * Static value Pseudonymize for ProcessingOperation. + */ + public static final ProcessingOperation PSEUDONYMIZE = fromString("Pseudonymize"); + + /** + * Static value Query for ProcessingOperation. + */ + public static final ProcessingOperation QUERY = fromString("Query"); + + /** + * Static value Record for ProcessingOperation. + */ + public static final ProcessingOperation RECORD = fromString("Record"); + + /** + * Static value Reformat for ProcessingOperation. + */ + public static final ProcessingOperation REFORMAT = fromString("Reformat"); + + /** + * Static value Remove for ProcessingOperation. + */ + public static final ProcessingOperation REMOVE = fromString("Remove"); + + /** + * Static value Restrict for ProcessingOperation. + */ + public static final ProcessingOperation RESTRICT = fromString("Restrict"); + + /** + * Static value Retrieve for ProcessingOperation. + */ + public static final ProcessingOperation RETRIEVE = fromString("Retrieve"); + + /** + * Static value Screen for ProcessingOperation. + */ + public static final ProcessingOperation SCREEN = fromString("Screen"); + + /** + * Static value Share for ProcessingOperation. + */ + public static final ProcessingOperation SHARE = fromString("Share"); + + /** + * Static value Store for ProcessingOperation. + */ + public static final ProcessingOperation STORE = fromString("Store"); + + /** + * Static value Structure for ProcessingOperation. + */ + public static final ProcessingOperation STRUCTURE = fromString("Structure"); + + /** + * Static value Transfer for ProcessingOperation. + */ + public static final ProcessingOperation TRANSFER = fromString("Transfer"); + + /** + * Static value Transform for ProcessingOperation. + */ + public static final ProcessingOperation TRANSFORM = fromString("Transform"); + + /** + * Static value Transmit for ProcessingOperation. + */ + public static final ProcessingOperation TRANSMIT = fromString("Transmit"); + + /** + * Static value Use for ProcessingOperation. + */ + public static final ProcessingOperation USE = fromString("Use"); + + /** + * Creates a new instance of ProcessingOperation value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProcessingOperation() { + } + + /** + * Creates or finds a ProcessingOperation from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProcessingOperation. + */ + public static ProcessingOperation fromString(String name) { + return fromString(name, ProcessingOperation.class); + } + + /** + * Gets known ProcessingOperation values. + * + * @return known ProcessingOperation values. + */ + public static Collection values() { + return values(ProcessingOperation.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..5e36b5ee1784 --- /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) TypeSpec 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 { + /** + * Resource has been created. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * The resource is being provisioned. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * The resource is updating. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * The resource is being deleted. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * The resource create or update request has been accepted. + */ + 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/Purpose.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Purpose.java new file mode 100644 index 000000000000..62f044c5d9c3 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Purpose.java @@ -0,0 +1,519 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Valid values for the purpose based on W3C Data Privacy Vocabulary v2 https://w3c.github.io/dpv/2.0/dpv/. + */ +public final class Purpose extends ExpandableStringEnum { + /** + * Static value Academic Research for Purpose. + */ + public static final Purpose ACADEMIC_RESEARCH = fromString("Academic Research"); + + /** + * Static value Account Management for Purpose. + */ + public static final Purpose ACCOUNT_MANAGEMENT = fromString("Account Management"); + + /** + * Static value Advertising for Purpose. + */ + public static final Purpose ADVERTISING = fromString("Advertising"); + + /** + * Static value Age Verification for Purpose. + */ + public static final Purpose AGE_VERIFICATION = fromString("Age Verification"); + + /** + * Static value Combat Climate Change for Purpose. + */ + public static final Purpose COMBAT_CLIMATE_CHANGE = fromString("Combat Climate Change"); + + /** + * Static value Commercial Purpose for Purpose. + */ + public static final Purpose COMMERCIAL_PURPOSE = fromString("Commercial Purpose"); + + /** + * Static value Commercial Research for Purpose. + */ + public static final Purpose COMMERCIAL_RESEARCH = fromString("Commercial Research"); + + /** + * Static value Communication For Customer Care for Purpose. + */ + public static final Purpose COMMUNICATION_FOR_CUSTOMER_CARE = fromString("Communication For Customer Care"); + + /** + * Static value Communication Management for Purpose. + */ + public static final Purpose COMMUNICATION_MANAGEMENT = fromString("Communication Management"); + + /** + * Static value Counter Money Laundering for Purpose. + */ + public static final Purpose COUNTER_MONEY_LAUNDERING = fromString("Counter Money Laundering"); + + /** + * Static value Counter-terrorism for Purpose. + */ + public static final Purpose COUNTERTERRORISM = fromString("Counter-terrorism"); + + /** + * Static value Credit Checking for Purpose. + */ + public static final Purpose CREDIT_CHECKING = fromString("Credit Checking"); + + /** + * Static value Customer Care for Purpose. + */ + public static final Purpose CUSTOMER_CARE = fromString("Customer Care"); + + /** + * Static value Customer Claims Management for Purpose. + */ + public static final Purpose CUSTOMER_CLAIMS_MANAGEMENT = fromString("Customer Claims Management"); + + /** + * Static value Customer Management for Purpose. + */ + public static final Purpose CUSTOMER_MANAGEMENT = fromString("Customer Management"); + + /** + * Static value Customer Order Management for Purpose. + */ + public static final Purpose CUSTOMER_ORDER_MANAGEMENT = fromString("Customer Order Management"); + + /** + * Static value Customer Relationship Management for Purpose. + */ + public static final Purpose CUSTOMER_RELATIONSHIP_MANAGEMENT = fromString("Customer Relationship Management"); + + /** + * Static value Customer Solvency Monitoring for Purpose. + */ + public static final Purpose CUSTOMER_SOLVENCY_MONITORING = fromString("Customer Solvency Monitoring"); + + /** + * Static value Data Altruism for Purpose. + */ + public static final Purpose DATA_ALTRUISM = fromString("Data Altruism"); + + /** + * Static value Delivery Of Goods for Purpose. + */ + public static final Purpose DELIVERY_OF_GOODS = fromString("Delivery Of Goods"); + + /** + * Static value Direct Marketing for Purpose. + */ + public static final Purpose DIRECT_MARKETING = fromString("Direct Marketing"); + + /** + * Static value Dispute Management for Purpose. + */ + public static final Purpose DISPUTE_MANAGEMENT = fromString("Dispute Management"); + + /** + * Static value Enforce Access Control for Purpose. + */ + public static final Purpose ENFORCE_ACCESS_CONTROL = fromString("Enforce Access Control"); + + /** + * Static value Enforce Security for Purpose. + */ + public static final Purpose ENFORCE_SECURITY = fromString("Enforce Security"); + + /** + * Static value Establish Contractual Agreement for Purpose. + */ + public static final Purpose ESTABLISH_CONTRACTUAL_AGREEMENT = fromString("Establish Contractual Agreement"); + + /** + * Static value Fraud Prevention And Detection for Purpose. + */ + public static final Purpose FRAUD_PREVENTION_AND_DETECTION = fromString("Fraud Prevention And Detection"); + + /** + * Static value Fulfillment Of Contractual Obligation for Purpose. + */ + public static final Purpose FULFILLMENT_OF_CONTRACTUAL_OBLIGATION + = fromString("Fulfillment Of Contractual Obligation"); + + /** + * Static value Fulfillment Of Obligation for Purpose. + */ + public static final Purpose FULFILLMENT_OF_OBLIGATION = fromString("Fulfillment Of Obligation"); + + /** + * Static value Human Resource Management for Purpose. + */ + public static final Purpose HUMAN_RESOURCE_MANAGEMENT = fromString("Human Resource Management"); + + /** + * Static value Identity Authentication for Purpose. + */ + public static final Purpose IDENTITY_AUTHENTICATION = fromString("Identity Authentication"); + + /** + * Static value Identity Verification for Purpose. + */ + public static final Purpose IDENTITY_VERIFICATION = fromString("Identity Verification"); + + /** + * Static value Improve Existing Products And Services for Purpose. + */ + public static final Purpose IMPROVE_EXISTING_PRODUCTS_AND_SERVICES + = fromString("Improve Existing Products And Services"); + + /** + * Static value Improve Healthcare for Purpose. + */ + public static final Purpose IMPROVE_HEALTHCARE = fromString("Improve Healthcare"); + + /** + * Static value Improve Internal CRM Processes for Purpose. + */ + public static final Purpose IMPROVE_INTERNAL_CRMPROCESSES = fromString("Improve Internal CRM Processes"); + + /** + * Static value Improve Public Services for Purpose. + */ + public static final Purpose IMPROVE_PUBLIC_SERVICES = fromString("Improve Public Services"); + + /** + * Static value Improve Transport Mobility for Purpose. + */ + public static final Purpose IMPROVE_TRANSPORT_MOBILITY = fromString("Improve Transport Mobility"); + + /** + * Static value Increase Service Robustness for Purpose. + */ + public static final Purpose INCREASE_SERVICE_ROBUSTNESS = fromString("Increase Service Robustness"); + + /** + * Static value Internal Resource Optimization for Purpose. + */ + public static final Purpose INTERNAL_RESOURCE_OPTIMIZATION = fromString("Internal Resource Optimization"); + + /** + * Static value Legal Compliance for Purpose. + */ + public static final Purpose LEGAL_COMPLIANCE = fromString("Legal Compliance"); + + /** + * Static value Maintain Credit Checking Database for Purpose. + */ + public static final Purpose MAINTAIN_CREDIT_CHECKING_DATABASE = fromString("Maintain Credit Checking Database"); + + /** + * Static value Maintain Credit Rating Database for Purpose. + */ + public static final Purpose MAINTAIN_CREDIT_RATING_DATABASE = fromString("Maintain Credit Rating Database"); + + /** + * Static value Maintain Fraud Database for Purpose. + */ + public static final Purpose MAINTAIN_FRAUD_DATABASE = fromString("Maintain Fraud Database"); + + /** + * Static value Marketing for Purpose. + */ + public static final Purpose MARKETING = fromString("Marketing"); + + /** + * Static value Member Partner Management for Purpose. + */ + public static final Purpose MEMBER_PARTNER_MANAGEMENT = fromString("Member Partner Management"); + + /** + * Static value Misuse Prevention And Detection for Purpose. + */ + public static final Purpose MISUSE_PREVENTION_AND_DETECTION = fromString("Misuse Prevention And Detection"); + + /** + * Static value Non Commercial Purpose for Purpose. + */ + public static final Purpose NON_COMMERCIAL_PURPOSE = fromString("Non Commercial Purpose"); + + /** + * Static value Non Commercial Research for Purpose. + */ + public static final Purpose NON_COMMERCIAL_RESEARCH = fromString("Non Commercial Research"); + + /** + * Static value Optimization For Consumer for Purpose. + */ + public static final Purpose OPTIMIZATION_FOR_CONSUMER = fromString("Optimization For Consumer"); + + /** + * Static value Optimization For Controller for Purpose. + */ + public static final Purpose OPTIMIZATION_FOR_CONTROLLER = fromString("Optimization For Controller"); + + /** + * Static value Optimize User Interface for Purpose. + */ + public static final Purpose OPTIMIZE_USER_INTERFACE = fromString("Optimize User Interface"); + + /** + * Static value Organization Compliance Management for Purpose. + */ + public static final Purpose ORGANIZATION_COMPLIANCE_MANAGEMENT = fromString("Organization Compliance Management"); + + /** + * Static value Organization Governance for Purpose. + */ + public static final Purpose ORGANIZATION_GOVERNANCE = fromString("Organization Governance"); + + /** + * Static value Organization Risk Management for Purpose. + */ + public static final Purpose ORGANIZATION_RISK_MANAGEMENT = fromString("Organization Risk Management"); + + /** + * Static value Payment Management for Purpose. + */ + public static final Purpose PAYMENT_MANAGEMENT = fromString("Payment Management"); + + /** + * Static value Personalization for Purpose. + */ + public static final Purpose PERSONALIZATION = fromString("Personalization"); + + /** + * Static value Personalized Advertising for Purpose. + */ + public static final Purpose PERSONALIZED_ADVERTISING = fromString("Personalized Advertising"); + + /** + * Static value Personalized Benefits for Purpose. + */ + public static final Purpose PERSONALIZED_BENEFITS = fromString("Personalized Benefits"); + + /** + * Static value Personnel Hiring for Purpose. + */ + public static final Purpose PERSONNEL_HIRING = fromString("Personnel Hiring"); + + /** + * Static value Personnel Management for Purpose. + */ + public static final Purpose PERSONNEL_MANAGEMENT = fromString("Personnel Management"); + + /** + * Static value Personnel Payment for Purpose. + */ + public static final Purpose PERSONNEL_PAYMENT = fromString("Personnel Payment"); + + /** + * Static value Protection Of IPR for Purpose. + */ + public static final Purpose PROTECTION_OF_IPR = fromString("Protection Of IPR"); + + /** + * Static value Protection Of National Security for Purpose. + */ + public static final Purpose PROTECTION_OF_NATIONAL_SECURITY = fromString("Protection Of National Security"); + + /** + * Static value Protection Of Public Security for Purpose. + */ + public static final Purpose PROTECTION_OF_PUBLIC_SECURITY = fromString("Protection Of Public Security"); + + /** + * Static value Provide Event Recommendations for Purpose. + */ + public static final Purpose PROVIDE_EVENT_RECOMMENDATIONS = fromString("Provide Event Recommendations"); + + /** + * Static value Provide Official Statistics for Purpose. + */ + public static final Purpose PROVIDE_OFFICIAL_STATISTICS = fromString("Provide Official Statistics"); + + /** + * Static value Provide Personalized Recommendations for Purpose. + */ + public static final Purpose PROVIDE_PERSONALIZED_RECOMMENDATIONS + = fromString("Provide Personalized Recommendations"); + + /** + * Static value Provide Product Recommendations for Purpose. + */ + public static final Purpose PROVIDE_PRODUCT_RECOMMENDATIONS = fromString("Provide Product Recommendations"); + + /** + * Static value Public Benefit for Purpose. + */ + public static final Purpose PUBLIC_BENEFIT = fromString("Public Benefit"); + + /** + * Static value Public Policy Making for Purpose. + */ + public static final Purpose PUBLIC_POLICY_MAKING = fromString("Public Policy Making"); + + /** + * Static value Public Relations for Purpose. + */ + public static final Purpose PUBLIC_RELATIONS = fromString("Public Relations"); + + /** + * Static value Record Management for Purpose. + */ + public static final Purpose RECORD_MANAGEMENT = fromString("Record Management"); + + /** + * Static value Repair Impairments for Purpose. + */ + public static final Purpose REPAIR_IMPAIRMENTS = fromString("Repair Impairments"); + + /** + * Static value Requested Service Provision for Purpose. + */ + public static final Purpose REQUESTED_SERVICE_PROVISION = fromString("Requested Service Provision"); + + /** + * Static value Research And Development for Purpose. + */ + public static final Purpose RESEARCH_AND_DEVELOPMENT = fromString("Research And Development"); + + /** + * Static value Rights Fulfillment for Purpose. + */ + public static final Purpose RIGHTS_FULFILLMENT = fromString("Rights Fulfillment"); + + /** + * Static value Scientific Research for Purpose. + */ + public static final Purpose SCIENTIFIC_RESEARCH = fromString("Scientific Research"); + + /** + * Static value Search Functionalities for Purpose. + */ + public static final Purpose SEARCH_FUNCTIONALITIES = fromString("Search Functionalities"); + + /** + * Static value Sell Data To Third Parties for Purpose. + */ + public static final Purpose SELL_DATA_TO_THIRD_PARTIES = fromString("Sell Data To Third Parties"); + + /** + * Static value Sell Insights From Data for Purpose. + */ + public static final Purpose SELL_INSIGHTS_FROM_DATA = fromString("Sell Insights From Data"); + + /** + * Static value Sell Products for Purpose. + */ + public static final Purpose SELL_PRODUCTS = fromString("Sell Products"); + + /** + * Static value Sell Products To Data Subject for Purpose. + */ + public static final Purpose SELL_PRODUCTS_TO_DATA_SUBJECT = fromString("Sell Products To Data Subject"); + + /** + * Static value Service Optimization for Purpose. + */ + public static final Purpose SERVICEOPTIMIZATION = fromString("Service Optimization"); + + /** + * Static value Service Personalization for Purpose. + */ + public static final Purpose SERVICE_PERSONALIZATION = fromString("Service Personalization"); + + /** + * Static value Service Provision for Purpose. + */ + public static final Purpose SERVICE_PROVISION = fromString("Service Provision"); + + /** + * Static value Service Registration for Purpose. + */ + public static final Purpose SERVICE_REGISTRATION = fromString("Service Registration"); + + /** + * Static value Service Usage Analytics for Purpose. + */ + public static final Purpose SERVICE_USAGE_ANALYTICS = fromString("Service Usage Analytics"); + + /** + * Static value Social Media Marketing for Purpose. + */ + public static final Purpose SOCIAL_MEDIA_MARKETING = fromString("Social Media Marketing"); + + /** + * Static value Targeted Advertising for Purpose. + */ + public static final Purpose TARGETED_ADVERTISING = fromString("Targeted Advertising"); + + /** + * Static value Technical Service Provision for Purpose. + */ + public static final Purpose TECHNICAL_SERVICE_PROVISION = fromString("Technical Service Provision"); + + /** + * Static value User Interface Personalization for Purpose. + */ + public static final Purpose USER_INTERFACE_PERSONALIZATION = fromString("User Interface Personalization"); + + /** + * Static value Vendor Management for Purpose. + */ + public static final Purpose VENDOR_MANAGEMENT = fromString("Vendor Management"); + + /** + * Static value Vendor Payment for Purpose. + */ + public static final Purpose VENDOR_PAYMENT = fromString("Vendor Payment"); + + /** + * Static value Vendor Records Management for Purpose. + */ + public static final Purpose VENDOR_RECORDS_MANAGEMENT = fromString("Vendor Records Management"); + + /** + * Static value Vendor Selection Assessment for Purpose. + */ + public static final Purpose VENDOR_SELECTION_ASSESSMENT = fromString("Vendor Selection Assessment"); + + /** + * Static value Verification for Purpose. + */ + public static final Purpose VERIFICATION = fromString("Verification"); + + /** + * Creates a new instance of Purpose value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Purpose() { + } + + /** + * Creates or finds a Purpose from its string representation. + * + * @param name a name to look for. + * @return the corresponding Purpose. + */ + public static Purpose fromString(String name) { + return fromString(name, Purpose.class); + } + + /** + * Gets known Purpose values. + * + * @return known Purpose values. + */ + public static Collection values() { + return values(Purpose.class); + } +} 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..cb01861d5a76 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/com/azure/resourcemanager/programmableconnectivity/models/Status.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * Description of the current status of the OperatorApiConnection resource. + */ +@Immutable +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. + */ + private Status() { + } + + /** + * Get the state property: Current state of the OperatorApiConnection resource. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the reason property: Explanation of the current state of the OperatorApiConnection resource. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * 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..f0a61db97add --- /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) TypeSpec 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..1fb1b9474104 --- /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) TypeSpec 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..08b1737425f6 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/java/module-info.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + opens com.azure.resourcemanager.programmableconnectivity.implementation.models to com.azure.core; +} 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/main/resources/azure-resourcemanager-programmableconnectivity.properties b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/resources/azure-resourcemanager-programmableconnectivity.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/main/resources/azure-resourcemanager-programmableconnectivity.properties @@ -0,0 +1 @@ +version=${project.version} 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..7a263d82b063 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysCreateOrUpdateSamples.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.resourcemanager.programmableconnectivity.models.ApplicationOwnerProperties; +import com.azure.resourcemanager.programmableconnectivity.models.ApplicationProperties; +import com.azure.resourcemanager.programmableconnectivity.models.Category; +import com.azure.resourcemanager.programmableconnectivity.models.GatewayProperties; +import com.azure.resourcemanager.programmableconnectivity.models.GeographicAddress; +import com.azure.resourcemanager.programmableconnectivity.models.LocalRepresentative; +import com.azure.resourcemanager.programmableconnectivity.models.OrganizationType; +import com.azure.resourcemanager.programmableconnectivity.models.Person; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Gateways CreateOrUpdate. + */ +public final class GatewaysCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-03-30-preview/Gateways_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_CreateOrUpdate_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysCreateOrUpdateMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways() + .define("GatewayName") + .withRegion("eastus") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf()) + .withProperties(new GatewayProperties() + .withConfiguredApplication(new ApplicationProperties().withName("Application Name") + .withApplicationDescription("Application description") + .withCategory(Category.ART_AND_DESIGN) + .withCommercialName("Contoso") + .withPrivacyRightsRequestEmailAddress("contact@contoso.com") + .withPrivacyPolicyUrl("http://contoso.com/privacy")) + .withConfiguredApplicationOwner(new ApplicationOwnerProperties().withName("Contoso") + .withLegalName("Contoso") + .withTradingName("Contoso") + .withOrganizationDescription("Description of Organisation") + .withTaxNumber("12345") + .withOrganizationType(OrganizationType.ACADEMIC_SCIENTIFIC_ORGANIZATION) + .withOrganizationIdentificationId("12345") + .withOrganizationIdentificationIssuer("ID issuer") + .withOrganizationIdentificationType("Tax number") + .withContactEmailAddress("contact@contoso.com") + .withLegalRepresentative(new Person().withFamilyName("Name") + .withGivenName("Name") + .withEmailAddress("contact@contoso.com")) + .withPrivacyManager(new Person().withFamilyName("Name") + .withGivenName("Name") + .withEmailAddress("contact@contoso.com")) + .withDataProtectionOfficer(new Person().withFamilyName("Name") + .withGivenName("Name") + .withEmailAddress("contact@contoso.com")) + .withRegisteredGeographicAddress(new GeographicAddress().withStreetNumber("1234") + .withStreetName("Street") + .withLocality("Locality") + .withCity("City") + .withStateOrProvince("State") + .withPostalCode("fakeTokenPlaceholder") + .withCountryCode("fakeTokenPlaceholder")) + .withPrivacyPolicyUrl("http://contoso.com/privacy") + .withLocalRepresentatives( + Arrays.asList(new LocalRepresentative().withCountryCode("fakeTokenPlaceholder") + .withRepresentative(new Person().withFamilyName("Name") + .withGivenName("Name") + .withEmailAddress("contact@contoso.com")))))) + .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..bd35f98ffe4d --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for Gateways Delete. + */ +public final class GatewaysDeleteSamples { + /* + * x-ms-original-file: 2025-03-30-preview/Gateways_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_Delete_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysDeleteMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways().delete("rgopenapi", "GatewayName", 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..082287ff096e --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for Gateways GetByResourceGroup. + */ +public final class GatewaysGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-03-30-preview/Gateways_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_Get_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysGetMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.gateways().getByResourceGroupWithResponse("rgopenapi", "GatewayName", 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..764ef219103b --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for Gateways ListByResourceGroup. + */ +public final class GatewaysListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-03-30-preview/Gateways_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_ListByResourceGroup_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysListByResourceGroupMaximumSetGeneratedByMaximumSetRule( + 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..e67a3474823c --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for Gateways List. + */ +public final class GatewaysListSamples { + /* + * x-ms-original-file: 2025-03-30-preview/Gateways_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_ListBySubscription_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysListBySubscriptionMaximumSetGeneratedByMaximumSetRule( + 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..15897c77cfbc --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewaysUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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: 2025-03-30-preview/Gateways_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Gateways_Update_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void gatewaysUpdateMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + Gateway resource = manager.gateways() + .getByResourceGroupWithResponse("rgopenapi", "GatewayName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).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..5ce0fd4fa2c4 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationsListSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-03-30-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operationsListMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-30-preview/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen - generated by [MinimumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operationsListMaximumSetGenGeneratedByMinimumSetRule( + 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..0c0ae69c13d5 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsCreateSamples.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.resourcemanager.programmableconnectivity.models.Context; +import com.azure.resourcemanager.programmableconnectivity.models.DataProcessing; +import com.azure.resourcemanager.programmableconnectivity.models.DataRegions; +import com.azure.resourcemanager.programmableconnectivity.models.DurationModel; +import com.azure.resourcemanager.programmableconnectivity.models.Frequency; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnectionProperties; +import com.azure.resourcemanager.programmableconnectivity.models.ProcessingOperation; +import com.azure.resourcemanager.programmableconnectivity.models.Purpose; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for OperatorApiConnections Create. + */ +public final class OperatorApiConnectionsCreateSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiConnections_Create_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Create_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsCreateMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections() + .define("operatorApiConnectionName") + .withRegion("eastus") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf()) + .withProperties(new OperatorApiConnectionProperties().withOperatorApiPlanId( + "/subscriptions/00000000-0000-0000-0000-00000000000/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans/livmzrh") + .withGatewayId( + "/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/example-rg/providers/Microsoft.ProgrammableConnectivity/gateways/cdvcixxcdhjqw") + .withPlanTermsAndConditionsAccepted(true) + .withPurposes(Arrays.asList(Purpose.fromString("Fraud Detection and Prevention"))) + .withPurposeReason("This application uses this API for this purpose because...") + .withDataProcessingList( + Arrays.asList(new DataProcessing().withProcessingOperation(ProcessingOperation.ACCESS) + .withContexts(Arrays.asList(Context.ALGORITHMIC_LOGIC)) + .withDuration(DurationModel.ENDLESS_DURATION) + .withFrequency(Frequency.CONTINUOUS_FREQUENCY) + .withTransitRegions(Arrays.asList(new DataRegions().withCountryCode("fakeTokenPlaceholder") + .withCommercialOrganization("Contoso") + .withCommercialActivity(true) + .withDataPrivacyFrameworkUrl("https://www.dataprivacyframework.gov/participant/0"))) + .withStorageRegions(Arrays.asList(new DataRegions().withCountryCode("fakeTokenPlaceholder") + .withCommercialOrganization("Contoso") + .withCommercialActivity(true) + .withDataPrivacyFrameworkUrl("https://www.dataprivacyframework.gov/participant/0")))))) + .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..672b39845deb --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for OperatorApiConnections Delete. + */ +public final class OperatorApiConnectionsDeleteSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiConnections_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Delete_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsDeleteMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections() + .delete("rgopenapi", "operatorApiConnectionName", 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..3d7e6161d39e --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for OperatorApiConnections GetByResourceGroup. + */ +public final class OperatorApiConnectionsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiConnections_Get_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Get_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsGetMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiConnections() + .getByResourceGroupWithResponse("rgopenapi", "operatorApiConnectionName", 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..b7143063030f --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for OperatorApiConnections ListByResourceGroup. + */ +public final class OperatorApiConnectionsListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiConnections_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_ListByResourceGroup_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsListByResourceGroupMaximumSetGeneratedByMaximumSetRule( + 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..3b7963769788 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for OperatorApiConnections List. + */ +public final class OperatorApiConnectionsListSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiConnections_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_ListBySubscription_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsListBySubscriptionMaximumSetGeneratedByMaximumSetRule( + 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..a1817c76a88c --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiConnectionsUpdateSamples.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.resourcemanager.programmableconnectivity.models.Context; +import com.azure.resourcemanager.programmableconnectivity.models.DataProcessing; +import com.azure.resourcemanager.programmableconnectivity.models.DataRegions; +import com.azure.resourcemanager.programmableconnectivity.models.DurationModel; +import com.azure.resourcemanager.programmableconnectivity.models.Frequency; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnection; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiConnectionUpdateProperties; +import com.azure.resourcemanager.programmableconnectivity.models.ProcessingOperation; +import com.azure.resourcemanager.programmableconnectivity.models.Purpose; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for OperatorApiConnections Update. + */ +public final class OperatorApiConnectionsUpdateSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiConnections_Update_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiConnections_Update_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiConnectionsUpdateMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + OperatorApiConnection resource = manager.operatorApiConnections() + .getByResourceGroupWithResponse("rgopenapi", "operatorApiConnectionName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf()) + .withProperties(new OperatorApiConnectionUpdateProperties().withOperatorApiPlanId( + "/subscriptions/00000000-0000-0000-0000-00000000000/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans/livmzrh") + .withPlanTermsAndConditionsAccepted(true) + .withPurposes(Arrays.asList(Purpose.fromString("Fraud Detection and Prevention"))) + .withPurposeReason("This application uses this API for this purpose because...") + .withDataProcessingList( + Arrays.asList(new DataProcessing().withProcessingOperation(ProcessingOperation.ACCESS) + .withContexts(Arrays.asList(Context.ALGORITHMIC_LOGIC)) + .withDuration(DurationModel.ENDLESS_DURATION) + .withFrequency(Frequency.CONTINUOUS_FREQUENCY) + .withTransitRegions(Arrays.asList(new DataRegions().withCountryCode("fakeTokenPlaceholder") + .withCommercialOrganization("Contoso") + .withCommercialActivity(true) + .withDataPrivacyFrameworkUrl("https://www.dataprivacyframework.gov/participant/0"))) + .withStorageRegions(Arrays.asList(new DataRegions().withCountryCode("fakeTokenPlaceholder") + .withCommercialOrganization("Contoso") + .withCommercialActivity(true) + .withDataPrivacyFrameworkUrl("https://www.dataprivacyframework.gov/participant/0")))))) + .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..6ba989d89b02 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for OperatorApiPlans Get. + */ +public final class OperatorApiPlansGetSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiPlans_Get_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiPlans_Get_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiPlansGetMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiPlans().getWithResponse("operatorApiPlanName", 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..49ed474dd6ee --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/samples/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +/** + * Samples for OperatorApiPlans List. + */ +public final class OperatorApiPlansListSamples { + /* + * x-ms-original-file: 2025-03-30-preview/OperatorApiPlans_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: OperatorApiPlans_ListBySubscription_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to ProgrammableConnectivityManager. + */ + public static void operatorApiPlansListBySubscriptionMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager manager) { + manager.operatorApiPlans().list("lbnapngejadkls", 18, 2, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/ApplicationPropertiesTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/ApplicationPropertiesTests.java new file mode 100644 index 000000000000..a63a2092dd70 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/ApplicationPropertiesTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programmableconnectivity.models.ApplicationProperties; +import com.azure.resourcemanager.programmableconnectivity.models.Category; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationProperties model = BinaryData.fromString( + "{\"name\":\"gakeqsr\",\"applicationDescription\":\"yb\",\"category\":\"Trading\",\"commercialName\":\"qedqytbciqfoufl\",\"privacyRightsRequestEmailAddress\":\"mnkzsmod\",\"privacyPolicyUrl\":\"glougpbk\"}") + .toObject(ApplicationProperties.class); + Assertions.assertEquals("gakeqsr", model.name()); + Assertions.assertEquals("yb", model.applicationDescription()); + Assertions.assertEquals(Category.TRADING, model.category()); + Assertions.assertEquals("qedqytbciqfoufl", model.commercialName()); + Assertions.assertEquals("mnkzsmod", model.privacyRightsRequestEmailAddress()); + Assertions.assertEquals("glougpbk", model.privacyPolicyUrl()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationProperties model = new ApplicationProperties().withName("gakeqsr") + .withApplicationDescription("yb") + .withCategory(Category.TRADING) + .withCommercialName("qedqytbciqfoufl") + .withPrivacyRightsRequestEmailAddress("mnkzsmod") + .withPrivacyPolicyUrl("glougpbk"); + model = BinaryData.fromObject(model).toObject(ApplicationProperties.class); + Assertions.assertEquals("gakeqsr", model.name()); + Assertions.assertEquals("yb", model.applicationDescription()); + Assertions.assertEquals(Category.TRADING, model.category()); + Assertions.assertEquals("qedqytbciqfoufl", model.commercialName()); + Assertions.assertEquals("mnkzsmod", model.privacyRightsRequestEmailAddress()); + Assertions.assertEquals("glougpbk", model.privacyPolicyUrl()); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewayTagsUpdateTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewayTagsUpdateTests.java new file mode 100644 index 000000000000..3425908af4f1 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/GatewayTagsUpdateTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programmableconnectivity.models.GatewayTagsUpdate; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class GatewayTagsUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GatewayTagsUpdate model + = BinaryData.fromString("{\"tags\":{\"xqabnmocpcysh\":\"vsnb\"}}").toObject(GatewayTagsUpdate.class); + Assertions.assertEquals("vsnb", model.tags().get("xqabnmocpcysh")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GatewayTagsUpdate model = new GatewayTagsUpdate().withTags(mapOf("xqabnmocpcysh", "vsnb")); + model = BinaryData.fromObject(model).toObject(GatewayTagsUpdate.class); + Assertions.assertEquals("vsnb", model.tags().get("xqabnmocpcysh")); + } + + // 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/test/java/com/azure/resourcemanager/programmableconnectivity/generated/MarketplacePropertiesTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/MarketplacePropertiesTests.java new file mode 100644 index 000000000000..6d80f08f87b8 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/MarketplacePropertiesTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programmableconnectivity.models.MarketplaceProperties; +import org.junit.jupiter.api.Assertions; + +public final class MarketplacePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MarketplaceProperties model = BinaryData.fromString( + "{\"offerId\":\"ou\",\"publisherId\":\"vudwtiukbldng\",\"planId\":\"ocipazyxoeg\",\"planTermsAndConditionsLinks\":[\"g\"]}") + .toObject(MarketplaceProperties.class); + Assertions.assertEquals("ou", model.offerId()); + Assertions.assertEquals("vudwtiukbldng", model.publisherId()); + Assertions.assertEquals("ocipazyxoeg", model.planId()); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationDisplayTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..201e1ea5b469 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationDisplayTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programmableconnectivity.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"cdm\",\"resource\":\"rcryuanzwuxzdxta\",\"operation\":\"lhmwhfpmrqobm\",\"description\":\"kknryrtihf\"}") + .toObject(OperationDisplay.class); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationInnerTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationInnerTests.java new file mode 100644 index 000000000000..24a0bcccde13 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperationInner; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationListResultTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationListResultTests.java new file mode 100644 index 000000000000..f62a05c67ff6 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programmableconnectivity.implementation.models.OperationListResult; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"hq\",\"isDataAction\":true,\"display\":{\"provider\":\"pybczmehmtzopb\",\"resource\":\"h\",\"operation\":\"pidgsybbejhphoyc\",\"description\":\"xaobhdxbmtqioqjz\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"fpownoizhwlr\",\"isDataAction\":false,\"display\":{\"provider\":\"oqijgkdmbpaz\",\"resource\":\"bc\",\"operation\":\"pdznrbtcqqjnqgl\",\"description\":\"gnufoooj\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"system\",\"actionType\":\"Internal\"}],\"nextLink\":\"kfo\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals("kfo", model.nextLink()); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationsListMockTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..39c2dc00147b --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperationsListMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager; +import com.azure.resourcemanager.programmableconnectivity.models.Operation; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"name\":\"psbjta\",\"isDataAction\":true,\"display\":{\"provider\":\"ywpmueefjzwfqkq\",\"resource\":\"ids\",\"operation\":\"onobglaocqx\",\"description\":\"cmgyud\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ProgrammableConnectivityManager manager = ProgrammableConnectivityManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlanInnerTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlanInnerTests.java new file mode 100644 index 000000000000..c242e42b294c --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlanInnerTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programmableconnectivity.fluent.models.OperatorApiPlanInner; +import org.junit.jupiter.api.Assertions; + +public final class OperatorApiPlanInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperatorApiPlanInner model = BinaryData.fromString( + "{\"properties\":{\"operatorName\":\"ajvnysounqe\",\"camaraApiName\":\"noae\",\"supportedLocations\":[\"hy\",\"ltrpmopj\",\"cma\",\"u\"],\"operatorRegions\":[\"hfuiuaodsfc\",\"kvxod\",\"uozmyzydagfua\",\"bezy\"],\"markets\":[\"kktwhrdxw\",\"ywqsmbsurexim\",\"ryocfsfksymdd\"],\"limits\":\"tki\",\"marketplaceProperties\":{\"offerId\":\"hqyudxorrqnbpoc\",\"publisherId\":\"yifqrvkdvjsllrmv\",\"planId\":\"f\",\"planTermsAndConditionsLinks\":[\"t\",\"pnpulexxbczwtru\"]},\"provisioningState\":\"Canceled\"},\"id\":\"bq\",\"name\":\"vsovmyokac\",\"type\":\"pkwlhz\"}") + .toObject(OperatorApiPlanInner.class); + Assertions.assertEquals("ajvnysounqe", model.properties().operatorName()); + Assertions.assertEquals("noae", model.properties().camaraApiName()); + Assertions.assertEquals("hy", model.properties().supportedLocations().get(0)); + Assertions.assertEquals("hfuiuaodsfc", model.properties().operatorRegions().get(0)); + Assertions.assertEquals("kktwhrdxw", model.properties().markets().get(0)); + Assertions.assertEquals("tki", model.properties().limits()); + Assertions.assertEquals("hqyudxorrqnbpoc", model.properties().marketplaceProperties().offerId()); + Assertions.assertEquals("yifqrvkdvjsllrmv", model.properties().marketplaceProperties().publisherId()); + Assertions.assertEquals("f", model.properties().marketplaceProperties().planId()); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlanListResultTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlanListResultTests.java new file mode 100644 index 000000000000..aeb8dc8a55d1 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlanListResultTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programmableconnectivity.implementation.models.OperatorApiPlanListResult; +import org.junit.jupiter.api.Assertions; + +public final class OperatorApiPlanListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperatorApiPlanListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"operatorName\":\"ucgygevqz\",\"camaraApiName\":\"yp\",\"supportedLocations\":[\"p\",\"zcdrqjsdpydnfyhx\",\"eoejzic\",\"ifsjttgzfbishcb\"],\"operatorRegions\":[\"jdeyeamdpha\",\"alpbuxwgipwhon\",\"wkgshwa\",\"kix\"],\"markets\":[\"njeputtmrywn\",\"zoqftiyqzrnkcqvy\"],\"limits\":\"whzlsicohoq\",\"marketplaceProperties\":{\"offerId\":\"vlryavwhheunmmq\",\"publisherId\":\"yxzk\",\"planId\":\"ocukoklyax\",\"planTermsAndConditionsLinks\":[\"onuq\",\"zf\",\"beypewrmjmw\",\"vjektcxsenh\"]},\"provisioningState\":\"Succeeded\"},\"id\":\"ffrzpwvlqdqgbiqy\",\"name\":\"ihkaetcktvfc\",\"type\":\"vf\"},{\"properties\":{\"operatorName\":\"ymuctqhjfbebrj\",\"camaraApiName\":\"erfuwuttt\",\"supportedLocations\":[\"jrbirphxepcyv\",\"hfnljkyq\",\"j\",\"uujqgidokgjljyo\"],\"operatorRegions\":[\"cltbgsncghkjesz\",\"hbijhtxfvgxb\",\"smx\"],\"markets\":[\"mpvecxgodebfqk\",\"rbmpukgri\"],\"limits\":\"lzlfbxzpuz\",\"marketplaceProperties\":{\"offerId\":\"spnqzahmgkb\",\"publisherId\":\"yydhibnuqqk\",\"planId\":\"kadrgvt\",\"planTermsAndConditionsLinks\":[\"gnbuy\"]},\"provisioningState\":\"Provisioning\"},\"id\":\"gg\",\"name\":\"ebf\",\"type\":\"iarbutrcvpna\"},{\"properties\":{\"operatorName\":\"hj\",\"camaraApiName\":\"nmpxttdb\",\"supportedLocations\":[\"nlankxmyskpb\",\"enbtkcxywny\",\"nrs\",\"nlqidybyxczf\"],\"operatorRegions\":[\"aaxdbabphlwrq\",\"fkts\",\"hsucoc\"],\"markets\":[\"yazttbtwwrqpue\",\"ckzywbiexzfeyue\"],\"limits\":\"ibx\",\"marketplaceProperties\":{\"offerId\":\"bhqwalmuzyoxa\",\"publisherId\":\"dkzjancuxrh\",\"planId\":\"bavxbniwdjswzt\",\"planTermsAndConditionsLinks\":[\"bpg\",\"xytxhpzxbz\",\"fzab\"]},\"provisioningState\":\"Failed\"},\"id\":\"hxw\",\"name\":\"ctyqik\",\"type\":\"bbovplwzbhvgyugu\"},{\"properties\":{\"operatorName\":\"mkfssxqukkfplgm\",\"camaraApiName\":\"xnkjzkdesl\",\"supportedLocations\":[\"opwi\",\"ighxpk\"],\"operatorRegions\":[\"baiuebbaumny\"],\"markets\":[\"edeojnabc\"],\"limits\":\"smtxpsieb\",\"marketplaceProperties\":{\"offerId\":\"vpesapskrdqmhjjd\",\"publisherId\":\"ldwkyzxuutkn\",\"planId\":\"scwsv\",\"planTermsAndConditionsLinks\":[\"otogtwrupqs\",\"vnm\",\"cykvceo\",\"eil\"]},\"provisioningState\":\"Accepted\"},\"id\":\"tyfjfcnjbkcnxdhb\",\"name\":\"tkphywpnvjtoqn\",\"type\":\"rmclfplphoxu\"}],\"nextLink\":\"rpabg\"}") + .toObject(OperatorApiPlanListResult.class); + Assertions.assertEquals("ucgygevqz", model.value().get(0).properties().operatorName()); + Assertions.assertEquals("yp", model.value().get(0).properties().camaraApiName()); + Assertions.assertEquals("p", model.value().get(0).properties().supportedLocations().get(0)); + Assertions.assertEquals("jdeyeamdpha", model.value().get(0).properties().operatorRegions().get(0)); + Assertions.assertEquals("njeputtmrywn", model.value().get(0).properties().markets().get(0)); + Assertions.assertEquals("whzlsicohoq", model.value().get(0).properties().limits()); + Assertions.assertEquals("vlryavwhheunmmq", model.value().get(0).properties().marketplaceProperties().offerId()); + Assertions.assertEquals("yxzk", model.value().get(0).properties().marketplaceProperties().publisherId()); + Assertions.assertEquals("ocukoklyax", model.value().get(0).properties().marketplaceProperties().planId()); + Assertions.assertEquals("rpabg", model.nextLink()); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlanPropertiesTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlanPropertiesTests.java new file mode 100644 index 000000000000..b18691da4357 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlanPropertiesTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiPlanProperties; +import org.junit.jupiter.api.Assertions; + +public final class OperatorApiPlanPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperatorApiPlanProperties model = BinaryData.fromString( + "{\"operatorName\":\"bpxjmfl\",\"camaraApiName\":\"vnchrkcci\",\"supportedLocations\":[\"juqk\",\"rsa\",\"iwkuofos\"],\"operatorRegions\":[\"sauuimj\",\"vxieduugidyj\",\"rfbyaosvexcso\",\"pclhocohslk\"],\"markets\":[\"eggzfb\",\"hfmvfaxkffe\"],\"limits\":\"th\",\"marketplaceProperties\":{\"offerId\":\"ez\",\"publisherId\":\"shxmzsbbzoggigrx\",\"planId\":\"ur\",\"planTermsAndConditionsLinks\":[\"xxjnspydptk\"]},\"provisioningState\":\"Updating\"}") + .toObject(OperatorApiPlanProperties.class); + Assertions.assertEquals("bpxjmfl", model.operatorName()); + Assertions.assertEquals("vnchrkcci", model.camaraApiName()); + Assertions.assertEquals("juqk", model.supportedLocations().get(0)); + Assertions.assertEquals("sauuimj", model.operatorRegions().get(0)); + Assertions.assertEquals("eggzfb", model.markets().get(0)); + Assertions.assertEquals("th", model.limits()); + Assertions.assertEquals("ez", model.marketplaceProperties().offerId()); + Assertions.assertEquals("shxmzsbbzoggigrx", model.marketplaceProperties().publisherId()); + Assertions.assertEquals("ur", model.marketplaceProperties().planId()); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansGetWithResponseMockTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansGetWithResponseMockTests.java new file mode 100644 index 000000000000..cb8d7588a555 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansGetWithResponseMockTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiPlan; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperatorApiPlansGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"operatorName\":\"utauv\",\"camaraApiName\":\"tkuwhhmhykojo\",\"supportedLocations\":[\"nn\",\"lpichk\"],\"operatorRegions\":[\"kcdyhbpk\",\"pwdreqnovvqf\",\"vljxywsu\",\"syrsndsytgadgvra\"],\"markets\":[\"neqn\"],\"limits\":\"rrwlquuijfqkace\",\"marketplaceProperties\":{\"offerId\":\"pfpubjibww\",\"publisherId\":\"tohqkvpuvksgp\",\"planId\":\"aknynfsynljphuop\",\"planTermsAndConditionsLinks\":[\"dlqiyntorzih\",\"eosjswsr\",\"slyzrpzbchckqq\"]},\"provisioningState\":\"Accepted\"},\"id\":\"xiy\",\"name\":\"uiizynke\",\"type\":\"yatrwy\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ProgrammableConnectivityManager manager = ProgrammableConnectivityManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + OperatorApiPlan response + = manager.operatorApiPlans().getWithResponse("erpqlpqwcciuqg", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("utauv", response.properties().operatorName()); + Assertions.assertEquals("tkuwhhmhykojo", response.properties().camaraApiName()); + Assertions.assertEquals("nn", response.properties().supportedLocations().get(0)); + Assertions.assertEquals("kcdyhbpk", response.properties().operatorRegions().get(0)); + Assertions.assertEquals("neqn", response.properties().markets().get(0)); + Assertions.assertEquals("rrwlquuijfqkace", response.properties().limits()); + Assertions.assertEquals("pfpubjibww", response.properties().marketplaceProperties().offerId()); + Assertions.assertEquals("tohqkvpuvksgp", response.properties().marketplaceProperties().publisherId()); + Assertions.assertEquals("aknynfsynljphuop", response.properties().marketplaceProperties().planId()); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansListMockTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansListMockTests.java new file mode 100644 index 000000000000..f564d83cdbec --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/OperatorApiPlansListMockTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.programmableconnectivity.ProgrammableConnectivityManager; +import com.azure.resourcemanager.programmableconnectivity.models.OperatorApiPlan; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperatorApiPlansListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"operatorName\":\"hwit\",\"camaraApiName\":\"ypyynpcdpumnzg\",\"supportedLocations\":[\"nmabik\"],\"operatorRegions\":[\"rgjhxb\",\"dtlwwrlkd\",\"tncvokot\"],\"markets\":[\"d\"],\"limits\":\"gsyocogj\",\"marketplaceProperties\":{\"offerId\":\"tbnnha\",\"publisherId\":\"ocrkvcikh\",\"planId\":\"p\",\"planTermsAndConditionsLinks\":[\"qgxqquezikyw\"]},\"provisioningState\":\"Provisioning\"},\"id\":\"allatmelwuipic\",\"name\":\"jzkzi\",\"type\":\"gvvcnayrhyr\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ProgrammableConnectivityManager manager = ProgrammableConnectivityManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.operatorApiPlans().list("q", 963712309, 937941437, com.azure.core.util.Context.NONE); + + Assertions.assertEquals("hwit", response.iterator().next().properties().operatorName()); + Assertions.assertEquals("ypyynpcdpumnzg", response.iterator().next().properties().camaraApiName()); + Assertions.assertEquals("nmabik", response.iterator().next().properties().supportedLocations().get(0)); + Assertions.assertEquals("rgjhxb", response.iterator().next().properties().operatorRegions().get(0)); + Assertions.assertEquals("d", response.iterator().next().properties().markets().get(0)); + Assertions.assertEquals("gsyocogj", response.iterator().next().properties().limits()); + Assertions.assertEquals("tbnnha", response.iterator().next().properties().marketplaceProperties().offerId()); + Assertions.assertEquals("ocrkvcikh", + response.iterator().next().properties().marketplaceProperties().publisherId()); + Assertions.assertEquals("p", response.iterator().next().properties().marketplaceProperties().planId()); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/PersonTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/PersonTests.java new file mode 100644 index 000000000000..dff42b3da0e9 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/PersonTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programmableconnectivity.models.Person; +import org.junit.jupiter.api.Assertions; + +public final class PersonTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Person model = BinaryData + .fromString("{\"familyName\":\"nsez\",\"givenName\":\"xtbzsgfyccsne\",\"emailAddress\":\"mdwzjeiachboo\"}") + .toObject(Person.class); + Assertions.assertEquals("nsez", model.familyName()); + Assertions.assertEquals("xtbzsgfyccsne", model.givenName()); + Assertions.assertEquals("mdwzjeiachboo", model.emailAddress()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Person model + = new Person().withFamilyName("nsez").withGivenName("xtbzsgfyccsne").withEmailAddress("mdwzjeiachboo"); + model = BinaryData.fromObject(model).toObject(Person.class); + Assertions.assertEquals("nsez", model.familyName()); + Assertions.assertEquals("xtbzsgfyccsne", model.givenName()); + Assertions.assertEquals("mdwzjeiachboo", model.emailAddress()); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/StatusTests.java b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/StatusTests.java new file mode 100644 index 000000000000..a30e6e064816 --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/src/test/java/com/azure/resourcemanager/programmableconnectivity/generated/StatusTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programmableconnectivity.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programmableconnectivity.models.Status; +import org.junit.jupiter.api.Assertions; + +public final class StatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Status model + = BinaryData.fromString("{\"state\":\"chcbonqvpkvlrxnj\",\"reason\":\"seiphe\"}").toObject(Status.class); + Assertions.assertEquals("chcbonqvpkvlrxnj", model.state()); + Assertions.assertEquals("seiphe", model.reason()); + } +} diff --git a/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/tsp-location.yaml b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/tsp-location.yaml new file mode 100644 index 000000000000..aa6e7979231b --- /dev/null +++ b/sdk/programmableconnectivity/azure-resourcemanager-programmableconnectivity/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/programmableconnectivity/ProgrammableConnectivity.Management +commit: c004d05a7251b79ee50b3a8842d1b35722f8c1a3 +repo: Azure/azure-rest-api-specs +additionalDirectories: 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 + +