diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b7e855905bac..f9d7a5e38964 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -473,6 +473,7 @@ com.azure.resourcemanager:azure-resourcemanager-databasewatcher;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-durabletask;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-arizeaiobservabilityeval;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-weightsandbiases;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-powerplatform;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 08b3c5475c08..7d7a4410a73d 100644 --- a/pom.xml +++ b/pom.xml @@ -176,6 +176,7 @@ sdk/postgresql sdk/postgresqlflexibleserver sdk/powerbidedicated + sdk/powerplatform sdk/providerhub sdk/purview sdk/quantum diff --git a/sdk/clientcore/annotation-processor/pom.xml b/sdk/clientcore/annotation-processor/pom.xml index 34d779ca6321..9ecda36fc602 100644 --- a/sdk/clientcore/annotation-processor/pom.xml +++ b/sdk/clientcore/annotation-processor/pom.xml @@ -113,7 +113,7 @@ io.clientcore core - 1.0.0-beta.9 + 1.0.0-beta.8 diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/CHANGELOG.md b/sdk/powerplatform/azure-resourcemanager-powerplatform/CHANGELOG.md new file mode 100644 index 000000000000..b8efef15be8a --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-04-07) + +- Azure Resource Manager PowerPlatform client library for Java. This package contains Microsoft Azure SDK for PowerPlatform Management SDK. Package tag package-2020-10-30-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-powerplatform Java SDK. diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/README.md b/sdk/powerplatform/azure-resourcemanager-powerplatform/README.md new file mode 100644 index 000000000000..853c740da03d --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager PowerPlatform client library for Java + +Azure Resource Manager PowerPlatform client library for Java. + +This package contains Microsoft Azure SDK for PowerPlatform Management SDK. Package tag package-2020-10-30-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-powerplatform;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-powerplatform + 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(); +PowerPlatformManager manager = PowerPlatformManager + .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/powerplatform/azure-resourcemanager-powerplatform/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/powerplatform/azure-resourcemanager-powerplatform/SAMPLE.md b/sdk/powerplatform/azure-resourcemanager-powerplatform/SAMPLE.md new file mode 100644 index 000000000000..f654163c12ab --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/SAMPLE.md @@ -0,0 +1,591 @@ +# Code snippets and samples + + +## Accounts + +- [CreateOrUpdate](#accounts_createorupdate) +- [Delete](#accounts_delete) +- [GetByResourceGroup](#accounts_getbyresourcegroup) +- [List](#accounts_list) +- [ListByResourceGroup](#accounts_listbyresourcegroup) +- [Update](#accounts_update) + +## EnterprisePolicies + +- [CreateOrUpdate](#enterprisepolicies_createorupdate) +- [Delete](#enterprisepolicies_delete) +- [GetByResourceGroup](#enterprisepolicies_getbyresourcegroup) +- [List](#enterprisepolicies_list) +- [ListByResourceGroup](#enterprisepolicies_listbyresourcegroup) +- [Update](#enterprisepolicies_update) + +## Operations + +- [List](#operations_list) + +## PrivateEndpointConnections + +- [CreateOrUpdate](#privateendpointconnections_createorupdate) +- [Delete](#privateendpointconnections_delete) +- [Get](#privateendpointconnections_get) +- [ListByEnterprisePolicy](#privateendpointconnections_listbyenterprisepolicy) + +## PrivateLinkResources + +- [Get](#privatelinkresources_get) +- [ListByEnterprisePolicy](#privatelinkresources_listbyenterprisepolicy) +### Accounts_CreateOrUpdate + +```java +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Accounts CreateOrUpdate. + */ +public final class AccountsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * createOrUpdateAccount.json + */ + /** + * Sample code: Create or update account. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void createOrUpdateAccount(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.accounts() + .define("account") + .withRegion("East US") + .withExistingResourceGroup("resourceGroup") + .withTags(mapOf("Organization", "Administration")) + .withDescription("Description of the account.") + .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; + } +} +``` + +### Accounts_Delete + +```java +/** + * Samples for Accounts Delete. + */ +public final class AccountsDeleteSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * deleteAccount.json + */ + /** + * Sample code: Delete account. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void deleteAccount(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.accounts() + .deleteByResourceGroupWithResponse("resourceGroup", "account", com.azure.core.util.Context.NONE); + } +} +``` + +### Accounts_GetByResourceGroup + +```java +/** + * Samples for Accounts GetByResourceGroup. + */ +public final class AccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * getAccount.json + */ + /** + * Sample code: Get account. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void getAccount(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.accounts().getByResourceGroupWithResponse("rg", "account", com.azure.core.util.Context.NONE); + } +} +``` + +### Accounts_List + +```java +/** + * Samples for Accounts List. + */ +public final class AccountsListSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * listAccountsBySubscription.json + */ + /** + * Sample code: List accounts by subscription. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + listAccountsBySubscription(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.accounts().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Accounts_ListByResourceGroup + +```java +/** + * Samples for Accounts ListByResourceGroup. + */ +public final class AccountsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * listAccountsByResourceGroup.json + */ + /** + * Sample code: List accounts by resource group. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + listAccountsByResourceGroup(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.accounts().listByResourceGroup("rg", com.azure.core.util.Context.NONE); + } +} +``` + +### Accounts_Update + +```java +import com.azure.resourcemanager.powerplatform.models.Account; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Accounts Update. + */ +public final class AccountsUpdateSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * updateAccount.json + */ + /** + * Sample code: Update account. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void updateAccount(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + Account resource = manager.accounts() + .getByResourceGroupWithResponse("resourceGroup", "account", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("Organization", "Administration")) + .withDescription("Description of account.") + .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; + } +} +``` + +### EnterprisePolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicyIdentity; +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicyKind; +import com.azure.resourcemanager.powerplatform.models.ResourceIdentityType; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnterprisePolicies CreateOrUpdate. + */ +public final class EnterprisePoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * createOrUpdateEnterprisePolicy.json + */ + /** + * Sample code: Create or update EnterprisePolicy. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + createOrUpdateEnterprisePolicy(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.enterprisePolicies() + .define("enterprisePolicy") + .withRegion("East US") + .withExistingResourceGroup("resourceGroup") + .withKind(EnterprisePolicyKind.LOCKBOX) + .withTags(mapOf("Organization", "Administration")) + .withIdentity(new EnterprisePolicyIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .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; + } +} +``` + +### EnterprisePolicies_Delete + +```java +/** + * Samples for EnterprisePolicies Delete. + */ +public final class EnterprisePoliciesDeleteSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * deleteEnterprisePolicy.json + */ + /** + * Sample code: Delete an EnterprisePolicy. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void deleteAnEnterprisePolicy(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.enterprisePolicies() + .deleteByResourceGroupWithResponse("resourceGroup", "enterprisePolicy", com.azure.core.util.Context.NONE); + } +} +``` + +### EnterprisePolicies_GetByResourceGroup + +```java +/** + * Samples for EnterprisePolicies GetByResourceGroup. + */ +public final class EnterprisePoliciesGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * getEnterprisePolicy.json + */ + /** + * Sample code: Get an EnterprisePolicy. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void getAnEnterprisePolicy(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.enterprisePolicies() + .getByResourceGroupWithResponse("rg", "enterprisePolicy", com.azure.core.util.Context.NONE); + } +} +``` + +### EnterprisePolicies_List + +```java +/** + * Samples for EnterprisePolicies List. + */ +public final class EnterprisePoliciesListSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * listEnterprisePoliciesBySubscription.json + */ + /** + * Sample code: List EnterprisePolicies by subscription. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + listEnterprisePoliciesBySubscription(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.enterprisePolicies().list(com.azure.core.util.Context.NONE); + } +} +``` + +### EnterprisePolicies_ListByResourceGroup + +```java +/** + * Samples for EnterprisePolicies ListByResourceGroup. + */ +public final class EnterprisePoliciesListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * listEnterprisePoliciesByResourceGroup.json + */ + /** + * Sample code: List EnterprisePolicies by resource group. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + listEnterprisePoliciesByResourceGroup(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.enterprisePolicies().listByResourceGroup("rg1", com.azure.core.util.Context.NONE); + } +} +``` + +### EnterprisePolicies_Update + +```java +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicy; +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicyIdentity; +import com.azure.resourcemanager.powerplatform.models.ResourceIdentityType; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnterprisePolicies Update. + */ +public final class EnterprisePoliciesUpdateSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * updateEnterprisePolicy.json + */ + /** + * Sample code: Update EnterprisePolicy. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void updateEnterprisePolicy(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + EnterprisePolicy resource = manager.enterprisePolicies() + .getByResourceGroupWithResponse("resourceGroup", "enterprisePolicy", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("Organization", "Administration")) + .withIdentity(new EnterprisePolicyIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * listOperations.json + */ + /** + * Sample code: Lists all of the available PowerPlatform REST API operations. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void listsAllOfTheAvailablePowerPlatformRESTAPIOperations( + com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.powerplatform.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.powerplatform.models.PrivateLinkServiceConnectionState; + +/** + * Samples for PrivateEndpointConnections CreateOrUpdate. + */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * PrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.privateEndpointConnections() + .define("privateEndpointConnectionName") + .withExistingEnterprisePolicy("rg1", "ddb1") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java +/** + * Samples for PrivateEndpointConnections Delete. + */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.privateEndpointConnections() + .deleteWithResponse("rg1", "ddb1", "privateEndpointConnectionName", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +/** + * Samples for PrivateEndpointConnections Get. + */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + getsPrivateEndpointConnection(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.privateEndpointConnections() + .getWithResponse("rg1", "ddb1", "privateEndpointConnectionName", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByEnterprisePolicy + +```java +/** + * Samples for PrivateEndpointConnections ListByEnterprisePolicy. + */ +public final class PrivateEndpointConnectionsListByEnterprisePolicySamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * PrivateEndpointConnectionListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + getsPrivateEndpointConnection(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.privateEndpointConnections().listByEnterprisePolicy("rg1", "ddb1", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkResources_Get + +```java +/** + * Samples for PrivateLinkResources Get. + */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * PrivateLinkResourceGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + getsPrivateEndpointConnection(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.privateLinkResources().getWithResponse("rg1", "ddb1", "sql", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkResources_ListByEnterprisePolicy + +```java +/** + * Samples for PrivateLinkResources ListByEnterprisePolicy. + */ +public final class PrivateLinkResourcesListByEnterprisePolicySamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * PrivateLinkResourceListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + getsPrivateEndpointConnection(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.privateLinkResources().listByEnterprisePolicy("rg1", "ddb1", com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/pom.xml b/sdk/powerplatform/azure-resourcemanager-powerplatform/pom.xml new file mode 100644 index 000000000000..4a6d25b61f90 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-powerplatform + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for PowerPlatform Management + This package contains Microsoft Azure SDK for PowerPlatform Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2020-10-30-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + false + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/PowerPlatformManager.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/PowerPlatformManager.java new file mode 100644 index 000000000000..2edb3a672a19 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/PowerPlatformManager.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform; + +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.powerplatform.fluent.PowerPlatform; +import com.azure.resourcemanager.powerplatform.implementation.AccountsImpl; +import com.azure.resourcemanager.powerplatform.implementation.EnterprisePoliciesImpl; +import com.azure.resourcemanager.powerplatform.implementation.OperationsImpl; +import com.azure.resourcemanager.powerplatform.implementation.PowerPlatformBuilder; +import com.azure.resourcemanager.powerplatform.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.powerplatform.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.powerplatform.models.Accounts; +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicies; +import com.azure.resourcemanager.powerplatform.models.Operations; +import com.azure.resourcemanager.powerplatform.models.PrivateEndpointConnections; +import com.azure.resourcemanager.powerplatform.models.PrivateLinkResources; +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 PowerPlatformManager. + */ +public final class PowerPlatformManager { + private Accounts accounts; + + private EnterprisePolicies enterprisePolicies; + + private Operations operations; + + private PrivateEndpointConnections privateEndpointConnections; + + private PrivateLinkResources privateLinkResources; + + private final PowerPlatform clientObject; + + private PowerPlatformManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new PowerPlatformBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of PowerPlatform service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the PowerPlatform service API instance. + */ + public static PowerPlatformManager 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 PowerPlatform service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the PowerPlatform service API instance. + */ + public static PowerPlatformManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new PowerPlatformManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create PowerPlatformManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new PowerPlatformManager.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-powerplatform.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 PowerPlatform service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the PowerPlatform service API instance. + */ + public PowerPlatformManager 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.powerplatform") + .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 PowerPlatformManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Accounts. It manages Account. + * + * @return Resource collection API of Accounts. + */ + public Accounts accounts() { + if (this.accounts == null) { + this.accounts = new AccountsImpl(clientObject.getAccounts(), this); + } + return accounts; + } + + /** + * Gets the resource collection API of EnterprisePolicies. It manages EnterprisePolicy. + * + * @return Resource collection API of EnterprisePolicies. + */ + public EnterprisePolicies enterprisePolicies() { + if (this.enterprisePolicies == null) { + this.enterprisePolicies = new EnterprisePoliciesImpl(clientObject.getEnterprisePolicies(), this); + } + return enterprisePolicies; + } + + /** + * 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 PrivateEndpointConnections. It manages PrivateEndpointConnection. + * + * @return Resource collection API of PrivateEndpointConnections. + */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections + = new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * Gets the resource collection API of PrivateLinkResources. + * + * @return Resource collection API of PrivateLinkResources. + */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** + * Gets wrapped service client PowerPlatform providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client PowerPlatform. + */ + public PowerPlatform serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/AccountsClient.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/AccountsClient.java new file mode 100644 index 000000000000..4e36e6e468f2 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/AccountsClient.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.models.AccountInner; +import com.azure.resourcemanager.powerplatform.models.PatchAccount; + +/** + * An instance of this class provides access to all the operations defined in AccountsClient. + */ +public interface AccountsClient { + /** + * Creates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update an account. + * @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 definition of the account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String accountName, String resourceGroupName, + AccountInner parameters, Context context); + + /** + * Creates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update an account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner createOrUpdate(String accountName, String resourceGroupName, AccountInner parameters); + + /** + * Get information about an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @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 information about an account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String accountName, + Context context); + + /** + * Get information about an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about an account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Delete an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Delete an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 accountName); + + /** + * Updates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update an account. + * @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 definition of the account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String accountName, String resourceGroupName, PatchAccount parameters, + Context context); + + /** + * Updates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update an account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner update(String accountName, String resourceGroupName, PatchAccount parameters); + + /** + * Retrieve a list of accounts within a given 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 the list accounts operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieve a list of accounts within a given 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 the list accounts operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieve a list of accounts within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list accounts operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Retrieve a list of accounts within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list accounts operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/EnterprisePoliciesClient.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/EnterprisePoliciesClient.java new file mode 100644 index 000000000000..9e627f3166b1 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/EnterprisePoliciesClient.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.models.EnterprisePolicyInner; +import com.azure.resourcemanager.powerplatform.models.PatchEnterprisePolicy; + +/** + * An instance of this class provides access to all the operations defined in EnterprisePoliciesClient. + */ +public interface EnterprisePoliciesClient { + /** + * Creates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update EnterprisePolicy. + * @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 definition of the EnterprisePolicy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String enterprisePolicyName, String resourceGroupName, + EnterprisePolicyInner parameters, Context context); + + /** + * Creates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update EnterprisePolicy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the EnterprisePolicy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnterprisePolicyInner createOrUpdate(String enterprisePolicyName, String resourceGroupName, + EnterprisePolicyInner parameters); + + /** + * Get information about an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName The EnterprisePolicy 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 information about an EnterprisePolicy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String enterprisePolicyName, Context context); + + /** + * Get information about an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName The EnterprisePolicy 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 information about an EnterprisePolicy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnterprisePolicyInner getByResourceGroup(String resourceGroupName, String enterprisePolicyName); + + /** + * Delete an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String enterprisePolicyName, Context context); + + /** + * Delete an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 enterprisePolicyName); + + /** + * Updates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update EnterprisePolicy. + * @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 definition of the EnterprisePolicy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String enterprisePolicyName, String resourceGroupName, + PatchEnterprisePolicy parameters, Context context); + + /** + * Updates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update EnterprisePolicy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the EnterprisePolicy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnterprisePolicyInner update(String enterprisePolicyName, String resourceGroupName, + PatchEnterprisePolicy parameters); + + /** + * Retrieve a list of EnterprisePolicies within a given 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 the list EnterprisePolicy operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieve a list of EnterprisePolicies within a given 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 the list EnterprisePolicy operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieve a list of EnterprisePolicies within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list EnterprisePolicy operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Retrieve a list of EnterprisePolicies within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list EnterprisePolicy operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/OperationsClient.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/OperationsClient.java new file mode 100644 index 000000000000..5da2e0d59180 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * Lists all of the available PowerPlatform REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available PowerPlatform REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/PowerPlatform.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/PowerPlatform.java new file mode 100644 index 000000000000..a9ebc60ba960 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/PowerPlatform.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for PowerPlatform class. + */ +public interface PowerPlatform { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + AccountsClient getAccounts(); + + /** + * Gets the EnterprisePoliciesClient object to access its operations. + * + * @return the EnterprisePoliciesClient object. + */ + EnterprisePoliciesClient getEnterprisePolicies(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/PrivateEndpointConnectionsClient.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 000000000000..de0b35e8ee58 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.models.PrivateEndpointConnectionInner; + +/** + * An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. + */ +public interface PrivateEndpointConnectionsClient { + /** + * List all private endpoint connections on an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 private endpoint connections as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName); + + /** + * List all private endpoint connections on an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters Parameters supplied to create or update a private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, + String enterprisePolicyName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters Parameters supplied to create or update a private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String enterprisePolicyName, String privateEndpointConnectionName); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/PrivateLinkResourcesClient.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 000000000000..56e75b215afb --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.models.PrivateLinkResourceInner; + +/** + * An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. + */ +public interface PrivateLinkResourcesClient { + /** + * Gets the private link resources that need to be created for enterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for enterprisePolicy as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName); + + /** + * Gets the private link resources that need to be created for enterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for enterprisePolicy as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName, Context context); + + /** + * Gets the private link resources that need to be created for an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for an EnterprisePolicy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String enterprisePolicyName, + String groupName, Context context); + + /** + * Gets the private link resources that need to be created for an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for an EnterprisePolicy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(String resourceGroupName, String enterprisePolicyName, String groupName); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/AccountInner.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/AccountInner.java new file mode 100644 index 000000000000..bdfebd3c6931 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/AccountInner.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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 java.io.IOException; +import java.util.Map; + +/** + * Definition of the account. + */ +@Fluent +public final class AccountInner extends Resource { + /* + * The properties that define configuration for the account. + */ + private AccountProperties innerProperties; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + 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 AccountInner class. + */ + public AccountInner() { + } + + /** + * Get the innerProperties property: The properties that define configuration for the account. + * + * @return the innerProperties value. + */ + private AccountProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @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 AccountInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AccountInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the systemId property: The internally assigned unique identifier of the resource. + * + * @return the systemId value. + */ + public String systemId() { + return this.innerProperties() == null ? null : this.innerProperties().systemId(); + } + + /** + * Get the description property: The description of the account. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the account. + * + * @param description the description value to set. + * @return the AccountInner object itself. + */ + public AccountInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AccountInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccountInner 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 AccountInner. + */ + public static AccountInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AccountInner deserializedAccountInner = new AccountInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAccountInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAccountInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAccountInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedAccountInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAccountInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedAccountInner.innerProperties = AccountProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAccountInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAccountInner; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/AccountProperties.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/AccountProperties.java new file mode 100644 index 000000000000..377d19d47653 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/AccountProperties.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties that define configuration for the account. + */ +@Fluent +public final class AccountProperties implements JsonSerializable { + /* + * The internally assigned unique identifier of the resource. + */ + private String systemId; + + /* + * The description of the account. + */ + private String description; + + /** + * Creates an instance of AccountProperties class. + */ + public AccountProperties() { + } + + /** + * Get the systemId property: The internally assigned unique identifier of the resource. + * + * @return the systemId value. + */ + public String systemId() { + return this.systemId; + } + + /** + * Get the description property: The description of the account. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the account. + * + * @param description the description value to set. + * @return the AccountProperties object itself. + */ + public AccountProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AccountProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccountProperties 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 AccountProperties. + */ + public static AccountProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AccountProperties deserializedAccountProperties = new AccountProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("systemId".equals(fieldName)) { + deserializedAccountProperties.systemId = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedAccountProperties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAccountProperties; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/EnterprisePolicyInner.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/EnterprisePolicyInner.java new file mode 100644 index 000000000000..168017ca5361 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/EnterprisePolicyInner.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicyIdentity; +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicyKind; +import com.azure.resourcemanager.powerplatform.models.HealthStatus; +import com.azure.resourcemanager.powerplatform.models.PropertiesEncryption; +import com.azure.resourcemanager.powerplatform.models.PropertiesLockbox; +import com.azure.resourcemanager.powerplatform.models.PropertiesNetworkInjection; +import java.io.IOException; +import java.util.Map; + +/** + * Definition of the EnterprisePolicy. + */ +@Fluent +public final class EnterprisePolicyInner extends Resource { + /* + * The identity of the EnterprisePolicy. + */ + private EnterprisePolicyIdentity identity; + + /* + * The kind (type) of Enterprise Policy. + */ + private EnterprisePolicyKind kind; + + /* + * The properties that define configuration for the enterprise policy + */ + private Properties innerProperties; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + 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 EnterprisePolicyInner class. + */ + public EnterprisePolicyInner() { + } + + /** + * Get the identity property: The identity of the EnterprisePolicy. + * + * @return the identity value. + */ + public EnterprisePolicyIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the EnterprisePolicy. + * + * @param identity the identity value to set. + * @return the EnterprisePolicyInner object itself. + */ + public EnterprisePolicyInner withIdentity(EnterprisePolicyIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the kind property: The kind (type) of Enterprise Policy. + * + * @return the kind value. + */ + public EnterprisePolicyKind kind() { + return this.kind; + } + + /** + * Set the kind property: The kind (type) of Enterprise Policy. + * + * @param kind the kind value to set. + * @return the EnterprisePolicyInner object itself. + */ + public EnterprisePolicyInner withKind(EnterprisePolicyKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the innerProperties property: The properties that define configuration for the enterprise policy. + * + * @return the innerProperties value. + */ + private Properties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @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 EnterprisePolicyInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public EnterprisePolicyInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the systemId property: The internally assigned unique identifier of the resource. + * + * @return the systemId value. + */ + public String systemId() { + return this.innerProperties() == null ? null : this.innerProperties().systemId(); + } + + /** + * Get the lockbox property: Settings concerning lockbox. + * + * @return the lockbox value. + */ + public PropertiesLockbox lockbox() { + return this.innerProperties() == null ? null : this.innerProperties().lockbox(); + } + + /** + * Set the lockbox property: Settings concerning lockbox. + * + * @param lockbox the lockbox value to set. + * @return the EnterprisePolicyInner object itself. + */ + public EnterprisePolicyInner withLockbox(PropertiesLockbox lockbox) { + if (this.innerProperties() == null) { + this.innerProperties = new Properties(); + } + this.innerProperties().withLockbox(lockbox); + return this; + } + + /** + * Get the encryption property: The encryption settings for a configuration store. + * + * @return the encryption value. + */ + public PropertiesEncryption encryption() { + return this.innerProperties() == null ? null : this.innerProperties().encryption(); + } + + /** + * Set the encryption property: The encryption settings for a configuration store. + * + * @param encryption the encryption value to set. + * @return the EnterprisePolicyInner object itself. + */ + public EnterprisePolicyInner withEncryption(PropertiesEncryption encryption) { + if (this.innerProperties() == null) { + this.innerProperties = new Properties(); + } + this.innerProperties().withEncryption(encryption); + return this; + } + + /** + * Get the networkInjection property: Settings concerning network injection. + * + * @return the networkInjection value. + */ + public PropertiesNetworkInjection networkInjection() { + return this.innerProperties() == null ? null : this.innerProperties().networkInjection(); + } + + /** + * Set the networkInjection property: Settings concerning network injection. + * + * @param networkInjection the networkInjection value to set. + * @return the EnterprisePolicyInner object itself. + */ + public EnterprisePolicyInner withNetworkInjection(PropertiesNetworkInjection networkInjection) { + if (this.innerProperties() == null) { + this.innerProperties = new Properties(); + } + this.innerProperties().withNetworkInjection(networkInjection); + return this; + } + + /** + * Get the healthStatus property: The health status of the resource. + * + * @return the healthStatus value. + */ + public HealthStatus healthStatus() { + return this.innerProperties() == null ? null : this.innerProperties().healthStatus(); + } + + /** + * Set the healthStatus property: The health status of the resource. + * + * @param healthStatus the healthStatus value to set. + * @return the EnterprisePolicyInner object itself. + */ + public EnterprisePolicyInner withHealthStatus(HealthStatus healthStatus) { + if (this.innerProperties() == null) { + this.innerProperties = new Properties(); + } + this.innerProperties().withHealthStatus(healthStatus); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (kind() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property kind in model EnterprisePolicyInner")); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EnterprisePolicyInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnterprisePolicyInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnterprisePolicyInner 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 EnterprisePolicyInner. + */ + public static EnterprisePolicyInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnterprisePolicyInner deserializedEnterprisePolicyInner = new EnterprisePolicyInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedEnterprisePolicyInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedEnterprisePolicyInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEnterprisePolicyInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedEnterprisePolicyInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedEnterprisePolicyInner.withTags(tags); + } else if ("kind".equals(fieldName)) { + deserializedEnterprisePolicyInner.kind = EnterprisePolicyKind.fromString(reader.getString()); + } else if ("identity".equals(fieldName)) { + deserializedEnterprisePolicyInner.identity = EnterprisePolicyIdentity.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedEnterprisePolicyInner.innerProperties = Properties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedEnterprisePolicyInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEnterprisePolicyInner; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/OperationInner.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/OperationInner.java new file mode 100644 index 000000000000..b722a4628365 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/OperationInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.powerplatform.models.ActionType; +import com.azure.resourcemanager.powerplatform.models.OperationDisplay; +import com.azure.resourcemanager.powerplatform.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/PrivateEndpointConnectionInner.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 000000000000..884f1f3e80ca --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.powerplatform.models.PrivateEndpoint; +import com.azure.resourcemanager.powerplatform.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.powerplatform.models.PrivateLinkServiceConnectionState; +import java.io.IOException; + +/** + * A private endpoint connection. + */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + private PrivateEndpointConnectionProperties innerProperties; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + 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 PrivateEndpointConnectionInner class. + */ + public PrivateEndpointConnectionInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the privateEndpoint property: The resource of private end point. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: The resource of private end point. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner + withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionInner 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 PrivateEndpointConnectionInner. + */ + public static PrivateEndpointConnectionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionInner deserializedPrivateEndpointConnectionInner + = new PrivateEndpointConnectionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.innerProperties + = PrivateEndpointConnectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionInner; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..403fcf005477 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.powerplatform.models.PrivateEndpoint; +import com.azure.resourcemanager.powerplatform.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.powerplatform.models.PrivateLinkServiceConnectionState; +import java.io.IOException; + +/** + * Properties of the PrivateEndpointConnectProperties. + */ +@Fluent +public final class PrivateEndpointConnectionProperties + implements JsonSerializable { + /* + * The resource of private end point. + */ + private PrivateEndpoint privateEndpoint; + + /* + * A collection of information about the state of the connection between service consumer and provider. + */ + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The provisioning state of the private endpoint connection resource. + */ + private PrivateEndpointConnectionProvisioningState provisioningState; + + /** + * Creates an instance of PrivateEndpointConnectionProperties class. + */ + public PrivateEndpointConnectionProperties() { + } + + /** + * Get the privateEndpoint property: The resource of private end point. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: The resource of private end point. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties + withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property privateLinkServiceConnectionState in model PrivateEndpointConnectionProperties")); + } else { + privateLinkServiceConnectionState().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("privateLinkServiceConnectionState", this.privateLinkServiceConnectionState); + jsonWriter.writeJsonField("privateEndpoint", this.privateEndpoint); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionProperties 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 PrivateEndpointConnectionProperties. + */ + public static PrivateEndpointConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionProperties deserializedPrivateEndpointConnectionProperties + = new PrivateEndpointConnectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("privateLinkServiceConnectionState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateLinkServiceConnectionState + = PrivateLinkServiceConnectionState.fromJson(reader); + } else if ("privateEndpoint".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateEndpoint = PrivateEndpoint.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.provisioningState + = PrivateEndpointConnectionProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionProperties; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/PrivateLinkResourceInner.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 000000000000..831fbf57ba13 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A private link resource. + */ +@Fluent +public final class PrivateLinkResourceInner extends ProxyResource { + /* + * Resource properties. + */ + private PrivateLinkResourceProperties innerProperties; + + /* + * 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 PrivateLinkResourceInner class. + */ + public PrivateLinkResourceInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateLinkResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.innerProperties() == null ? null : this.innerProperties().groupId(); + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.innerProperties() == null ? null : this.innerProperties().requiredMembers(); + } + + /** + * Get the requiredZoneNames property: The private link resource Private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.innerProperties() == null ? null : this.innerProperties().requiredZoneNames(); + } + + /** + * Set the requiredZoneNames property: The private link resource Private link DNS zone name. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the PrivateLinkResourceInner object itself. + */ + public PrivateLinkResourceInner withRequiredZoneNames(List requiredZoneNames) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateLinkResourceProperties(); + } + this.innerProperties().withRequiredZoneNames(requiredZoneNames); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceInner 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 PrivateLinkResourceInner. + */ + public static PrivateLinkResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceInner deserializedPrivateLinkResourceInner = new PrivateLinkResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateLinkResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateLinkResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateLinkResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateLinkResourceInner.innerProperties + = PrivateLinkResourceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceInner; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/PrivateLinkResourceProperties.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/PrivateLinkResourceProperties.java new file mode 100644 index 000000000000..2a0d0b480fa4 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/PrivateLinkResourceProperties.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a private link resource. + */ +@Fluent +public final class PrivateLinkResourceProperties implements JsonSerializable { + /* + * The private link resource group id. + */ + private String groupId; + + /* + * The private link resource required member names. + */ + private List requiredMembers; + + /* + * The private link resource Private link DNS zone name. + */ + private List requiredZoneNames; + + /** + * Creates an instance of PrivateLinkResourceProperties class. + */ + public PrivateLinkResourceProperties() { + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The private link resource Private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Set the requiredZoneNames property: The private link resource Private link DNS zone name. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the PrivateLinkResourceProperties object itself. + */ + public PrivateLinkResourceProperties withRequiredZoneNames(List requiredZoneNames) { + this.requiredZoneNames = requiredZoneNames; + 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.writeArrayField("requiredZoneNames", this.requiredZoneNames, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceProperties 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 PrivateLinkResourceProperties. + */ + public static PrivateLinkResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceProperties deserializedPrivateLinkResourceProperties + = new PrivateLinkResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("groupId".equals(fieldName)) { + deserializedPrivateLinkResourceProperties.groupId = reader.getString(); + } else if ("requiredMembers".equals(fieldName)) { + List requiredMembers = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredMembers = requiredMembers; + } else if ("requiredZoneNames".equals(fieldName)) { + List requiredZoneNames = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredZoneNames = requiredZoneNames; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceProperties; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/Properties.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/Properties.java new file mode 100644 index 000000000000..d104bd22bdd0 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/Properties.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.powerplatform.models.HealthStatus; +import com.azure.resourcemanager.powerplatform.models.PropertiesEncryption; +import com.azure.resourcemanager.powerplatform.models.PropertiesLockbox; +import com.azure.resourcemanager.powerplatform.models.PropertiesNetworkInjection; +import java.io.IOException; + +/** + * The properties that define configuration for the enterprise policy. + */ +@Fluent +public final class Properties implements JsonSerializable { + /* + * The internally assigned unique identifier of the resource. + */ + private String systemId; + + /* + * Settings concerning lockbox. + */ + private PropertiesLockbox lockbox; + + /* + * The encryption settings for a configuration store. + */ + private PropertiesEncryption encryption; + + /* + * Settings concerning network injection. + */ + private PropertiesNetworkInjection networkInjection; + + /* + * The health status of the resource. + */ + private HealthStatus healthStatus; + + /** + * Creates an instance of Properties class. + */ + public Properties() { + } + + /** + * Get the systemId property: The internally assigned unique identifier of the resource. + * + * @return the systemId value. + */ + public String systemId() { + return this.systemId; + } + + /** + * Get the lockbox property: Settings concerning lockbox. + * + * @return the lockbox value. + */ + public PropertiesLockbox lockbox() { + return this.lockbox; + } + + /** + * Set the lockbox property: Settings concerning lockbox. + * + * @param lockbox the lockbox value to set. + * @return the Properties object itself. + */ + public Properties withLockbox(PropertiesLockbox lockbox) { + this.lockbox = lockbox; + return this; + } + + /** + * Get the encryption property: The encryption settings for a configuration store. + * + * @return the encryption value. + */ + public PropertiesEncryption encryption() { + return this.encryption; + } + + /** + * Set the encryption property: The encryption settings for a configuration store. + * + * @param encryption the encryption value to set. + * @return the Properties object itself. + */ + public Properties withEncryption(PropertiesEncryption encryption) { + this.encryption = encryption; + return this; + } + + /** + * Get the networkInjection property: Settings concerning network injection. + * + * @return the networkInjection value. + */ + public PropertiesNetworkInjection networkInjection() { + return this.networkInjection; + } + + /** + * Set the networkInjection property: Settings concerning network injection. + * + * @param networkInjection the networkInjection value to set. + * @return the Properties object itself. + */ + public Properties withNetworkInjection(PropertiesNetworkInjection networkInjection) { + this.networkInjection = networkInjection; + return this; + } + + /** + * Get the healthStatus property: The health status of the resource. + * + * @return the healthStatus value. + */ + public HealthStatus healthStatus() { + return this.healthStatus; + } + + /** + * Set the healthStatus property: The health status of the resource. + * + * @param healthStatus the healthStatus value to set. + * @return the Properties object itself. + */ + public Properties withHealthStatus(HealthStatus healthStatus) { + this.healthStatus = healthStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (lockbox() != null) { + lockbox().validate(); + } + if (encryption() != null) { + encryption().validate(); + } + if (networkInjection() != null) { + networkInjection().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("lockbox", this.lockbox); + jsonWriter.writeJsonField("encryption", this.encryption); + jsonWriter.writeJsonField("networkInjection", this.networkInjection); + jsonWriter.writeStringField("healthStatus", this.healthStatus == null ? null : this.healthStatus.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Properties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Properties 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 Properties. + */ + public static Properties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Properties deserializedProperties = new Properties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("systemId".equals(fieldName)) { + deserializedProperties.systemId = reader.getString(); + } else if ("lockbox".equals(fieldName)) { + deserializedProperties.lockbox = PropertiesLockbox.fromJson(reader); + } else if ("encryption".equals(fieldName)) { + deserializedProperties.encryption = PropertiesEncryption.fromJson(reader); + } else if ("networkInjection".equals(fieldName)) { + deserializedProperties.networkInjection = PropertiesNetworkInjection.fromJson(reader); + } else if ("healthStatus".equals(fieldName)) { + deserializedProperties.healthStatus = HealthStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedProperties; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/package-info.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/package-info.java new file mode 100644 index 000000000000..e2fef90848aa --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for PowerPlatform. + * null. + */ +package com.azure.resourcemanager.powerplatform.fluent.models; diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/package-info.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/package-info.java new file mode 100644 index 000000000000..8ade80627212 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for PowerPlatform. + * null. + */ +package com.azure.resourcemanager.powerplatform.fluent; diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/AccountImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/AccountImpl.java new file mode 100644 index 000000000000..9b9bc44bda7e --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/AccountImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.powerplatform.fluent.models.AccountInner; +import com.azure.resourcemanager.powerplatform.models.Account; +import com.azure.resourcemanager.powerplatform.models.PatchAccount; +import java.util.Collections; +import java.util.Map; + +public final class AccountImpl implements Account, Account.Definition, Account.Update { + private AccountInner innerObject; + + private final com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String systemId() { + return this.innerModel().systemId(); + } + + public String description() { + return this.innerModel().description(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AccountInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.powerplatform.PowerPlatformManager manager() { + return this.serviceManager; + } + + private String accountName; + + private String resourceGroupName; + + private PatchAccount updateParameters; + + public AccountImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Account create() { + this.innerObject = serviceManager.serviceClient() + .getAccounts() + .createOrUpdateWithResponse(accountName, resourceGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Account create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAccounts() + .createOrUpdateWithResponse(accountName, resourceGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + AccountImpl(String name, com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager) { + this.innerObject = new AccountInner(); + this.serviceManager = serviceManager; + this.accountName = name; + } + + public AccountImpl update() { + this.updateParameters = new PatchAccount(); + return this; + } + + public Account apply() { + this.innerObject = serviceManager.serviceClient() + .getAccounts() + .updateWithResponse(accountName, resourceGroupName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public Account apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAccounts() + .updateWithResponse(accountName, resourceGroupName, updateParameters, context) + .getValue(); + return this; + } + + AccountImpl(AccountInner innerObject, com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "accounts"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + } + + public Account refresh() { + this.innerObject = serviceManager.serviceClient() + .getAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public Account refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public AccountImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AccountImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AccountImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public AccountImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateParameters.withDescription(description); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/AccountsClientImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/AccountsClientImpl.java new file mode 100644 index 000000000000..78428129320d --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/AccountsClientImpl.java @@ -0,0 +1,989 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.powerplatform.fluent.AccountsClient; +import com.azure.resourcemanager.powerplatform.fluent.models.AccountInner; +import com.azure.resourcemanager.powerplatform.models.AccountList; +import com.azure.resourcemanager.powerplatform.models.PatchAccount; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AccountsClient. + */ +public final class AccountsClientImpl implements AccountsClient { + /** + * The proxy service used to perform REST calls. + */ + private final AccountsService service; + + /** + * The service client containing this operation class. + */ + private final PowerPlatformImpl client; + + /** + * Initializes an instance of AccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AccountsClientImpl(PowerPlatformImpl client) { + this.service = RestProxy.create(AccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PowerPlatformAccounts to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PowerPlatformAccount") + public interface AccountsService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/accounts/{accountName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("accountName") String accountName, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AccountInner parameters, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/accounts/{accountName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/accounts/{accountName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/accounts/{accountName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @PathParam("accountName") String accountName, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PatchAccount parameters, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/accounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.PowerPlatform/accounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Creates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update an account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the account along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String accountName, String resourceGroupName, + AccountInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), accountName, + this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), parameters, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update an account. + * @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 definition of the account along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String accountName, String resourceGroupName, + AccountInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), accountName, this.client.getSubscriptionId(), + resourceGroupName, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * Creates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update an account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the account on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String accountName, String resourceGroupName, + AccountInner parameters) { + return createOrUpdateWithResponseAsync(accountName, resourceGroupName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update an account. + * @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 definition of the account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String accountName, String resourceGroupName, + AccountInner parameters, Context context) { + return createOrUpdateWithResponseAsync(accountName, resourceGroupName, parameters, context).block(); + } + + /** + * Creates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update an account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner createOrUpdate(String accountName, String resourceGroupName, AccountInner parameters) { + return createOrUpdateWithResponse(accountName, resourceGroupName, parameters, Context.NONE).getValue(); + } + + /** + * Get information about an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about an account along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String accountName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, + this.client.getSubscriptionId(), accountName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get information about an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @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 information about an account along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(), + accountName, this.client.getApiVersion(), accept, context); + } + + /** + * Get information about an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about an account on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get information about an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @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 information about an account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String accountName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Get information about an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about an account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + /** + * Delete an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 accountName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, + this.client.getSubscriptionId(), accountName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @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 accountName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(), + accountName, this.client.getApiVersion(), accept, context); + } + + /** + * Delete an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 accountName) { + return deleteWithResponseAsync(resourceGroupName, accountName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String accountName, Context context) { + return deleteWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Delete an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 accountName) { + deleteWithResponse(resourceGroupName, accountName, Context.NONE); + } + + /** + * Updates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update an account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the account along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String accountName, String resourceGroupName, + PatchAccount parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.update(this.client.getEndpoint(), accountName, this.client.getSubscriptionId(), + resourceGroupName, this.client.getApiVersion(), parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update an account. + * @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 definition of the account along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String accountName, String resourceGroupName, + PatchAccount parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), accountName, this.client.getSubscriptionId(), + resourceGroupName, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * Updates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update an account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the account on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String accountName, String resourceGroupName, PatchAccount parameters) { + return updateWithResponseAsync(accountName, resourceGroupName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update an account. + * @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 definition of the account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String accountName, String resourceGroupName, + PatchAccount parameters, Context context) { + return updateWithResponseAsync(accountName, resourceGroupName, parameters, context).block(); + } + + /** + * Updates an account. + * + * @param accountName Name of the account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update an account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner update(String accountName, String resourceGroupName, PatchAccount parameters) { + return updateWithResponse(accountName, resourceGroupName, parameters, Context.NONE).getValue(); + } + + /** + * Retrieve a list of accounts within a given 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 the list accounts 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.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve a list of accounts within a given 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 the list accounts 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.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Retrieve a list of accounts within a given 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 the list accounts operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve a list of accounts within a given 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 the list accounts 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)); + } + + /** + * Retrieve a list of accounts within a given 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 the list accounts operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Retrieve a list of accounts within a given 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 the list accounts operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Retrieve a list of accounts within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list accounts 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.getSubscriptionId(), + this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve a list of accounts within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list accounts 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.getSubscriptionId(), this.client.getApiVersion(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Retrieve a list of accounts within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list accounts operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve a list of accounts within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list accounts 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)); + } + + /** + * Retrieve a list of accounts within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list accounts operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Retrieve a list of accounts within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list accounts 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 the list accounts 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 the list accounts 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 the list accounts 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 the list accounts 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/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/AccountsImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/AccountsImpl.java new file mode 100644 index 000000000000..d963bcb482fb --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/AccountsImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.AccountsClient; +import com.azure.resourcemanager.powerplatform.fluent.models.AccountInner; +import com.azure.resourcemanager.powerplatform.models.Account; +import com.azure.resourcemanager.powerplatform.models.Accounts; + +public final class AccountsImpl implements Accounts { + private static final ClientLogger LOGGER = new ClientLogger(AccountsImpl.class); + + private final AccountsClient innerClient; + + private final com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager; + + public AccountsImpl(AccountsClient innerClient, + com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String accountName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AccountImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Account getByResourceGroup(String resourceGroupName, String accountName) { + AccountInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, accountName); + if (inner != null) { + return new AccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String accountName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, accountName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String accountName) { + this.serviceClient().delete(resourceGroupName, accountName); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public Account 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 accountName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, 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 accountName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, 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 accountName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE); + } + + public Response 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 accountName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, accountName, context); + } + + private AccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.powerplatform.PowerPlatformManager manager() { + return this.serviceManager; + } + + public AccountImpl define(String name) { + return new AccountImpl(name, this.manager()); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/EnterprisePoliciesClientImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/EnterprisePoliciesClientImpl.java new file mode 100644 index 000000000000..dc1d802c5552 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/EnterprisePoliciesClientImpl.java @@ -0,0 +1,1009 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.powerplatform.fluent.EnterprisePoliciesClient; +import com.azure.resourcemanager.powerplatform.fluent.models.EnterprisePolicyInner; +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicyList; +import com.azure.resourcemanager.powerplatform.models.PatchEnterprisePolicy; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in EnterprisePoliciesClient. + */ +public final class EnterprisePoliciesClientImpl implements EnterprisePoliciesClient { + /** + * The proxy service used to perform REST calls. + */ + private final EnterprisePoliciesService service; + + /** + * The service client containing this operation class. + */ + private final PowerPlatformImpl client; + + /** + * Initializes an instance of EnterprisePoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnterprisePoliciesClientImpl(PowerPlatformImpl client) { + this.service = RestProxy.create(EnterprisePoliciesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PowerPlatformEnterprisePolicies to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PowerPlatformEnterpr") + public interface EnterprisePoliciesService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/enterprisePolicies/{enterprisePolicyName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("enterprisePolicyName") String enterprisePolicyName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") EnterprisePolicyInner parameters, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/enterprisePolicies/{enterprisePolicyName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("enterprisePolicyName") String enterprisePolicyName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/enterprisePolicies/{enterprisePolicyName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enterprisePolicyName") String enterprisePolicyName, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/enterprisePolicies/{enterprisePolicyName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @PathParam("enterprisePolicyName") String enterprisePolicyName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PatchEnterprisePolicy parameters, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/enterprisePolicies") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.PowerPlatform/enterprisePolicies") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Creates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update EnterprisePolicy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the EnterprisePolicy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String enterprisePolicyName, + String resourceGroupName, EnterprisePolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), enterprisePolicyName, + this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), parameters, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update EnterprisePolicy. + * @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 definition of the EnterprisePolicy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String enterprisePolicyName, + String resourceGroupName, EnterprisePolicyInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), enterprisePolicyName, this.client.getSubscriptionId(), + resourceGroupName, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * Creates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update EnterprisePolicy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the EnterprisePolicy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String enterprisePolicyName, String resourceGroupName, + EnterprisePolicyInner parameters) { + return createOrUpdateWithResponseAsync(enterprisePolicyName, resourceGroupName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update EnterprisePolicy. + * @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 definition of the EnterprisePolicy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String enterprisePolicyName, + String resourceGroupName, EnterprisePolicyInner parameters, Context context) { + return createOrUpdateWithResponseAsync(enterprisePolicyName, resourceGroupName, parameters, context).block(); + } + + /** + * Creates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to create or update EnterprisePolicy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the EnterprisePolicy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnterprisePolicyInner createOrUpdate(String enterprisePolicyName, String resourceGroupName, + EnterprisePolicyInner parameters) { + return createOrUpdateWithResponse(enterprisePolicyName, resourceGroupName, parameters, Context.NONE).getValue(); + } + + /** + * Get information about an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName The EnterprisePolicy 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 information about an EnterprisePolicy along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String enterprisePolicyName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, + this.client.getSubscriptionId(), enterprisePolicyName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get information about an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName The EnterprisePolicy 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 information about an EnterprisePolicy along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String enterprisePolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(), + enterprisePolicyName, this.client.getApiVersion(), accept, context); + } + + /** + * Get information about an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName The EnterprisePolicy 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 information about an EnterprisePolicy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String enterprisePolicyName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, enterprisePolicyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get information about an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName The EnterprisePolicy 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 information about an EnterprisePolicy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String enterprisePolicyName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, enterprisePolicyName, context).block(); + } + + /** + * Get information about an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName The EnterprisePolicy 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 information about an EnterprisePolicy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnterprisePolicyInner getByResourceGroup(String resourceGroupName, String enterprisePolicyName) { + return getByResourceGroupWithResponse(resourceGroupName, enterprisePolicyName, Context.NONE).getValue(); + } + + /** + * Delete an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 enterprisePolicyName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName 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.delete(this.client.getEndpoint(), resourceGroupName, enterprisePolicyName, + this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @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 enterprisePolicyName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName 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.delete(this.client.getEndpoint(), resourceGroupName, enterprisePolicyName, + this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context); + } + + /** + * Delete an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 enterprisePolicyName) { + return deleteWithResponseAsync(resourceGroupName, enterprisePolicyName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String enterprisePolicyName, Context context) { + return deleteWithResponseAsync(resourceGroupName, enterprisePolicyName, context).block(); + } + + /** + * Delete an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 enterprisePolicyName) { + deleteWithResponse(resourceGroupName, enterprisePolicyName, Context.NONE); + } + + /** + * Updates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update EnterprisePolicy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the EnterprisePolicy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String enterprisePolicyName, + String resourceGroupName, PatchEnterprisePolicy parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), enterprisePolicyName, + this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), parameters, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update EnterprisePolicy. + * @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 definition of the EnterprisePolicy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String enterprisePolicyName, + String resourceGroupName, PatchEnterprisePolicy parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), enterprisePolicyName, this.client.getSubscriptionId(), + resourceGroupName, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * Updates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update EnterprisePolicy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the EnterprisePolicy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String enterprisePolicyName, String resourceGroupName, + PatchEnterprisePolicy parameters) { + return updateWithResponseAsync(enterprisePolicyName, resourceGroupName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update EnterprisePolicy. + * @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 definition of the EnterprisePolicy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String enterprisePolicyName, String resourceGroupName, + PatchEnterprisePolicy parameters, Context context) { + return updateWithResponseAsync(enterprisePolicyName, resourceGroupName, parameters, context).block(); + } + + /** + * Updates an EnterprisePolicy. + * + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters supplied to update EnterprisePolicy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of the EnterprisePolicy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnterprisePolicyInner update(String enterprisePolicyName, String resourceGroupName, + PatchEnterprisePolicy parameters) { + return updateWithResponse(enterprisePolicyName, resourceGroupName, parameters, Context.NONE).getValue(); + } + + /** + * Retrieve a list of EnterprisePolicies within a given 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 the list EnterprisePolicy 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.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve a list of EnterprisePolicies within a given 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 the list EnterprisePolicy 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.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Retrieve a list of EnterprisePolicies within a given 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 the list EnterprisePolicy operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve a list of EnterprisePolicies within a given 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 the list EnterprisePolicy 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)); + } + + /** + * Retrieve a list of EnterprisePolicies within a given 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 the list EnterprisePolicy operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Retrieve a list of EnterprisePolicies within a given 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 the list EnterprisePolicy operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Retrieve a list of EnterprisePolicies within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list EnterprisePolicy 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.getSubscriptionId(), + this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve a list of EnterprisePolicies within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list EnterprisePolicy 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.getSubscriptionId(), this.client.getApiVersion(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Retrieve a list of EnterprisePolicies within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list EnterprisePolicy operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve a list of EnterprisePolicies within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list EnterprisePolicy 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)); + } + + /** + * Retrieve a list of EnterprisePolicies within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list EnterprisePolicy operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Retrieve a list of EnterprisePolicies within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list EnterprisePolicy 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 the list EnterprisePolicy 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 the list EnterprisePolicy 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 the list EnterprisePolicy 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 the list EnterprisePolicy 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/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/EnterprisePoliciesImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/EnterprisePoliciesImpl.java new file mode 100644 index 000000000000..84f35cc8f783 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/EnterprisePoliciesImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.EnterprisePoliciesClient; +import com.azure.resourcemanager.powerplatform.fluent.models.EnterprisePolicyInner; +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicies; +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicy; + +public final class EnterprisePoliciesImpl implements EnterprisePolicies { + private static final ClientLogger LOGGER = new ClientLogger(EnterprisePoliciesImpl.class); + + private final EnterprisePoliciesClient innerClient; + + private final com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager; + + public EnterprisePoliciesImpl(EnterprisePoliciesClient innerClient, + com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String enterprisePolicyName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, enterprisePolicyName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EnterprisePolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EnterprisePolicy getByResourceGroup(String resourceGroupName, String enterprisePolicyName) { + EnterprisePolicyInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, enterprisePolicyName); + if (inner != null) { + return new EnterprisePolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String enterprisePolicyName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, enterprisePolicyName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String enterprisePolicyName) { + this.serviceClient().delete(resourceGroupName, enterprisePolicyName); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnterprisePolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnterprisePolicyImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnterprisePolicyImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnterprisePolicyImpl(inner1, this.manager())); + } + + public EnterprisePolicy 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 enterprisePolicyName = ResourceManagerUtils.getValueFromIdByName(id, "enterprisePolicies"); + if (enterprisePolicyName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enterprisePolicies'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, enterprisePolicyName, 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 enterprisePolicyName = ResourceManagerUtils.getValueFromIdByName(id, "enterprisePolicies"); + if (enterprisePolicyName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enterprisePolicies'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, enterprisePolicyName, 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 enterprisePolicyName = ResourceManagerUtils.getValueFromIdByName(id, "enterprisePolicies"); + if (enterprisePolicyName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enterprisePolicies'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, enterprisePolicyName, Context.NONE); + } + + public Response 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 enterprisePolicyName = ResourceManagerUtils.getValueFromIdByName(id, "enterprisePolicies"); + if (enterprisePolicyName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enterprisePolicies'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, enterprisePolicyName, context); + } + + private EnterprisePoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.powerplatform.PowerPlatformManager manager() { + return this.serviceManager; + } + + public EnterprisePolicyImpl define(String name) { + return new EnterprisePolicyImpl(name, this.manager()); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/EnterprisePolicyImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/EnterprisePolicyImpl.java new file mode 100644 index 000000000000..66d1c03b648d --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/EnterprisePolicyImpl.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.powerplatform.fluent.models.EnterprisePolicyInner; +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicy; +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicyIdentity; +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicyKind; +import com.azure.resourcemanager.powerplatform.models.HealthStatus; +import com.azure.resourcemanager.powerplatform.models.PatchEnterprisePolicy; +import com.azure.resourcemanager.powerplatform.models.PropertiesEncryption; +import com.azure.resourcemanager.powerplatform.models.PropertiesLockbox; +import com.azure.resourcemanager.powerplatform.models.PropertiesNetworkInjection; +import java.util.Collections; +import java.util.Map; + +public final class EnterprisePolicyImpl + implements EnterprisePolicy, EnterprisePolicy.Definition, EnterprisePolicy.Update { + private EnterprisePolicyInner innerObject; + + private final com.azure.resourcemanager.powerplatform.PowerPlatformManager 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 EnterprisePolicyIdentity identity() { + return this.innerModel().identity(); + } + + public EnterprisePolicyKind kind() { + return this.innerModel().kind(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String systemId() { + return this.innerModel().systemId(); + } + + public PropertiesLockbox lockbox() { + return this.innerModel().lockbox(); + } + + public PropertiesEncryption encryption() { + return this.innerModel().encryption(); + } + + public PropertiesNetworkInjection networkInjection() { + return this.innerModel().networkInjection(); + } + + public HealthStatus healthStatus() { + return this.innerModel().healthStatus(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public EnterprisePolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.powerplatform.PowerPlatformManager manager() { + return this.serviceManager; + } + + private String enterprisePolicyName; + + private String resourceGroupName; + + private PatchEnterprisePolicy updateParameters; + + public EnterprisePolicyImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public EnterprisePolicy create() { + this.innerObject = serviceManager.serviceClient() + .getEnterprisePolicies() + .createOrUpdateWithResponse(enterprisePolicyName, resourceGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public EnterprisePolicy create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getEnterprisePolicies() + .createOrUpdateWithResponse(enterprisePolicyName, resourceGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + EnterprisePolicyImpl(String name, com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager) { + this.innerObject = new EnterprisePolicyInner(); + this.serviceManager = serviceManager; + this.enterprisePolicyName = name; + } + + public EnterprisePolicyImpl update() { + this.updateParameters = new PatchEnterprisePolicy(); + return this; + } + + public EnterprisePolicy apply() { + this.innerObject = serviceManager.serviceClient() + .getEnterprisePolicies() + .updateWithResponse(enterprisePolicyName, resourceGroupName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public EnterprisePolicy apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getEnterprisePolicies() + .updateWithResponse(enterprisePolicyName, resourceGroupName, updateParameters, context) + .getValue(); + return this; + } + + EnterprisePolicyImpl(EnterprisePolicyInner innerObject, + com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.enterprisePolicyName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "enterprisePolicies"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + } + + public EnterprisePolicy refresh() { + this.innerObject = serviceManager.serviceClient() + .getEnterprisePolicies() + .getByResourceGroupWithResponse(resourceGroupName, enterprisePolicyName, Context.NONE) + .getValue(); + return this; + } + + public EnterprisePolicy refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getEnterprisePolicies() + .getByResourceGroupWithResponse(resourceGroupName, enterprisePolicyName, context) + .getValue(); + return this; + } + + public EnterprisePolicyImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public EnterprisePolicyImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public EnterprisePolicyImpl withKind(EnterprisePolicyKind kind) { + if (isInCreateMode()) { + this.innerModel().withKind(kind); + return this; + } else { + this.updateParameters.withKind(kind); + return this; + } + } + + public EnterprisePolicyImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public EnterprisePolicyImpl withIdentity(EnterprisePolicyIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public EnterprisePolicyImpl withLockbox(PropertiesLockbox lockbox) { + if (isInCreateMode()) { + this.innerModel().withLockbox(lockbox); + return this; + } else { + this.updateParameters.withLockbox(lockbox); + return this; + } + } + + public EnterprisePolicyImpl withEncryption(PropertiesEncryption encryption) { + if (isInCreateMode()) { + this.innerModel().withEncryption(encryption); + return this; + } else { + this.updateParameters.withEncryption(encryption); + return this; + } + } + + public EnterprisePolicyImpl withNetworkInjection(PropertiesNetworkInjection networkInjection) { + if (isInCreateMode()) { + this.innerModel().withNetworkInjection(networkInjection); + return this; + } else { + this.updateParameters.withNetworkInjection(networkInjection); + return this; + } + } + + public EnterprisePolicyImpl withHealthStatus(HealthStatus healthStatus) { + if (isInCreateMode()) { + this.innerModel().withHealthStatus(healthStatus); + return this; + } else { + this.updateParameters.withHealthStatus(healthStatus); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/OperationImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/OperationImpl.java new file mode 100644 index 000000000000..5831db858b20 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.implementation; + +import com.azure.resourcemanager.powerplatform.fluent.models.OperationInner; +import com.azure.resourcemanager.powerplatform.models.ActionType; +import com.azure.resourcemanager.powerplatform.models.Operation; +import com.azure.resourcemanager.powerplatform.models.OperationDisplay; +import com.azure.resourcemanager.powerplatform.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.powerplatform.PowerPlatformManager 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.powerplatform.PowerPlatformManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/OperationsClientImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..877a02ed4a1c --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.OperationsClient; +import com.azure.resourcemanager.powerplatform.fluent.models.OperationInner; +import com.azure.resourcemanager.powerplatform.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 PowerPlatformImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(PowerPlatformImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PowerPlatformOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PowerPlatformOperati") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.PowerPlatform/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Lists all of the available PowerPlatform REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available PowerPlatform REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists all of the available PowerPlatform REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available PowerPlatform REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available PowerPlatform REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available PowerPlatform REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable 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/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/OperationsImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/OperationsImpl.java new file mode 100644 index 000000000000..3d73ca8198d9 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.OperationsClient; +import com.azure.resourcemanager.powerplatform.fluent.models.OperationInner; +import com.azure.resourcemanager.powerplatform.models.Operation; +import com.azure.resourcemanager.powerplatform.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.powerplatform.PowerPlatformManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.powerplatform.PowerPlatformManager 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.powerplatform.PowerPlatformManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PowerPlatformBuilder.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PowerPlatformBuilder.java new file mode 100644 index 000000000000..3b53235377ed --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PowerPlatformBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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 PowerPlatformImpl type. + */ +@ServiceClientBuilder(serviceClients = { PowerPlatformImpl.class }) +public final class PowerPlatformBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the PowerPlatformBuilder. + */ + public PowerPlatformBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the PowerPlatformBuilder. + */ + public PowerPlatformBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the PowerPlatformBuilder. + */ + public PowerPlatformBuilder 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 PowerPlatformBuilder. + */ + public PowerPlatformBuilder 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 PowerPlatformBuilder. + */ + public PowerPlatformBuilder 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 PowerPlatformBuilder. + */ + public PowerPlatformBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of PowerPlatformImpl with the provided parameters. + * + * @return an instance of PowerPlatformImpl. + */ + public PowerPlatformImpl 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(); + PowerPlatformImpl client = new PowerPlatformImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PowerPlatformImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PowerPlatformImpl.java new file mode 100644 index 000000000000..cc8ddb5864ce --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PowerPlatformImpl.java @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.AccountsClient; +import com.azure.resourcemanager.powerplatform.fluent.EnterprisePoliciesClient; +import com.azure.resourcemanager.powerplatform.fluent.OperationsClient; +import com.azure.resourcemanager.powerplatform.fluent.PowerPlatform; +import com.azure.resourcemanager.powerplatform.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.powerplatform.fluent.PrivateLinkResourcesClient; +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 PowerPlatformImpl type. + */ +@ServiceClient(builder = PowerPlatformBuilder.class) +public final class PowerPlatformImpl implements PowerPlatform { + /** + * The ID of the target subscription. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * server parameter. + */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Api Version. + */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The AccountsClient object to access its operations. + */ + private final AccountsClient accounts; + + /** + * Gets the AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + public AccountsClient getAccounts() { + return this.accounts; + } + + /** + * The EnterprisePoliciesClient object to access its operations. + */ + private final EnterprisePoliciesClient enterprisePolicies; + + /** + * Gets the EnterprisePoliciesClient object to access its operations. + * + * @return the EnterprisePoliciesClient object. + */ + public EnterprisePoliciesClient getEnterprisePolicies() { + return this.enterprisePolicies; + } + + /** + * 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 PrivateEndpointConnectionsClient object to access its operations. + */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * The PrivateLinkResourcesClient object to access its operations. + */ + private final PrivateLinkResourcesClient privateLinkResources; + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + public PrivateLinkResourcesClient getPrivateLinkResources() { + return this.privateLinkResources; + } + + /** + * Initializes an instance of PowerPlatform client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + PowerPlatformImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String subscriptionId, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2020-10-30-preview"; + this.accounts = new AccountsClientImpl(this); + this.enterprisePolicies = new EnterprisePoliciesClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(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(PowerPlatformImpl.class); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateEndpointConnectionImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 000000000000..d482464dd156 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.powerplatform.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.powerplatform.models.PrivateEndpoint; +import com.azure.resourcemanager.powerplatform.models.PrivateEndpointConnection; +import com.azure.resourcemanager.powerplatform.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.powerplatform.models.PrivateLinkServiceConnectionState; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public PrivateEndpoint privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.powerplatform.PowerPlatformManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String enterprisePolicyName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName) { + this.resourceGroupName = resourceGroupName; + this.enterprisePolicyName = enterprisePolicyName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .createOrUpdateWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .createOrUpdateWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, + this.innerModel(), context) + .getValue(); + return this; + } + + PrivateEndpointConnectionImpl(String name, + com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .createOrUpdateWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .createOrUpdateWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, + this.innerModel(), context) + .getValue(); + return this; + } + + PrivateEndpointConnectionImpl(PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.enterprisePolicyName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "enterprisePolicies"); + this.privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl + withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 000000000000..3d129343a1ad --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,688 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.powerplatform.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.powerplatform.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.powerplatform.models.PrivateEndpointConnectionListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. + */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrivateEndpointConnectionsService service; + + /** + * The service client containing this operation class. + */ + private final PowerPlatformImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(PowerPlatformImpl client) { + this.service = RestProxy.create(PrivateEndpointConnectionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PowerPlatformPrivateEndpointConnections to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PowerPlatformPrivate") + public interface PrivateEndpointConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/enterprisePolicies/{enterprisePolicyName}/privateEndpointConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByEnterprisePolicy(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @PathParam("enterprisePolicyName") String enterprisePolicyName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/enterprisePolicies/{enterprisePolicyName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @PathParam("enterprisePolicyName") String enterprisePolicyName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/enterprisePolicies/{enterprisePolicyName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @PathParam("enterprisePolicyName") String enterprisePolicyName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") PrivateEndpointConnectionInner parameters, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/enterprisePolicies/{enterprisePolicyName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @PathParam("enterprisePolicyName") String enterprisePolicyName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List all private endpoint connections on an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connections along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByEnterprisePolicySinglePageAsync(String resourceGroupName, String enterprisePolicyName) { + 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 (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByEnterprisePolicy(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, this.client.getApiVersion(), enterprisePolicyName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all private endpoint connections on an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByEnterprisePolicySinglePageAsync(String resourceGroupName, String enterprisePolicyName, 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 (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByEnterprisePolicy(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), enterprisePolicyName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), null, null)); + } + + /** + * List all private endpoint connections on an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connections as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByEnterprisePolicyAsync(String resourceGroupName, + String enterprisePolicyName) { + return new PagedFlux<>(() -> listByEnterprisePolicySinglePageAsync(resourceGroupName, enterprisePolicyName)); + } + + /** + * List all private endpoint connections on an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByEnterprisePolicyAsync(String resourceGroupName, + String enterprisePolicyName, Context context) { + return new PagedFlux<>( + () -> listByEnterprisePolicySinglePageAsync(resourceGroupName, enterprisePolicyName, context)); + } + + /** + * List all private endpoint connections on an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connections as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName) { + return new PagedIterable<>(listByEnterprisePolicyAsync(resourceGroupName, enterprisePolicyName)); + } + + /** + * List all private endpoint connections on an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName, Context context) { + return new PagedIterable<>(listByEnterprisePolicyAsync(resourceGroupName, enterprisePolicyName, context)); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String enterprisePolicyName, String privateEndpointConnectionName) { + 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 (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), enterprisePolicyName, privateEndpointConnectionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String enterprisePolicyName, String privateEndpointConnectionName, 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 (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), enterprisePolicyName, privateEndpointConnectionName, accept, context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String enterprisePolicyName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, context) + .block(); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters Parameters supplied to create or update a private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String enterprisePolicyName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, this.client.getApiVersion(), enterprisePolicyName, privateEndpointConnectionName, + parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters Parameters supplied to create or update a private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String enterprisePolicyName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), enterprisePolicyName, privateEndpointConnectionName, parameters, accept, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters Parameters supplied to create or update a private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String enterprisePolicyName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, + parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters Parameters supplied to create or update a private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String enterprisePolicyName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, + parameters, context).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters Parameters supplied to create or update a private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, + parameters, Context.NONE).getValue(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName) { + 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 (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), enterprisePolicyName, privateEndpointConnectionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName, 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 (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), enterprisePolicyName, privateEndpointConnectionName, accept, context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName) { + return deleteWithResponseAsync(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName, Context context) { + return deleteWithResponseAsync(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, context) + .block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String enterprisePolicyName, String privateEndpointConnectionName) { + deleteWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateEndpointConnectionsImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 000000000000..b51b02c5160c --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.powerplatform.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.powerplatform.models.PrivateEndpointConnection; +import com.azure.resourcemanager.powerplatform.models.PrivateEndpointConnections; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager; + + public PrivateEndpointConnectionsImpl(PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName) { + PagedIterable inner + = this.serviceClient().listByEnterprisePolicy(resourceGroupName, enterprisePolicyName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName, Context context) { + PagedIterable inner + = this.serviceClient().listByEnterprisePolicy(resourceGroupName, enterprisePolicyName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnection get(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner + = this.serviceClient().get(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, context); + } + + public void delete(String resourceGroupName, String enterprisePolicyName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName); + } + + public PrivateEndpointConnection 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 enterprisePolicyName = ResourceManagerUtils.getValueFromIdByName(id, "enterprisePolicies"); + if (enterprisePolicyName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enterprisePolicies'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this + .getWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, 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 enterprisePolicyName = ResourceManagerUtils.getValueFromIdByName(id, "enterprisePolicies"); + if (enterprisePolicyName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enterprisePolicies'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, 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 enterprisePolicyName = ResourceManagerUtils.getValueFromIdByName(id, "enterprisePolicies"); + if (enterprisePolicyName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enterprisePolicies'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + this.deleteWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, Context.NONE); + } + + public Response 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 enterprisePolicyName = ResourceManagerUtils.getValueFromIdByName(id, "enterprisePolicies"); + if (enterprisePolicyName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enterprisePolicies'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.deleteWithResponse(resourceGroupName, enterprisePolicyName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.powerplatform.PowerPlatformManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateLinkResourceImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 000000000000..87221c13f3da --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateLinkResourceImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.implementation; + +import com.azure.resourcemanager.powerplatform.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.powerplatform.models.PrivateLinkResource; +import java.util.Collections; +import java.util.List; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager; + + PrivateLinkResourceImpl(PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.powerplatform.PowerPlatformManager 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 String groupId() { + return this.innerModel().groupId(); + } + + public List requiredMembers() { + List inner = this.innerModel().requiredMembers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List requiredZoneNames() { + List inner = this.innerModel().requiredZoneNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.powerplatform.PowerPlatformManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateLinkResourcesClientImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 000000000000..a03479074349 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.powerplatform.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.powerplatform.models.PrivateLinkResourceListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. + */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrivateLinkResourcesService service; + + /** + * The service client containing this operation class. + */ + private final PowerPlatformImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(PowerPlatformImpl client) { + this.service = RestProxy.create(PrivateLinkResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PowerPlatformPrivateLinkResources to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PowerPlatformPrivate") + public interface PrivateLinkResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/enterprisePolicies/{enterprisePolicyName}/privateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByEnterprisePolicy(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @PathParam("enterprisePolicyName") String enterprisePolicyName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerPlatform/enterprisePolicies/{enterprisePolicyName}/privateLinkResources/{groupName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @PathParam("enterprisePolicyName") String enterprisePolicyName, @PathParam("groupName") String groupName, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the private link resources that need to be created for enterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for enterprisePolicy along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByEnterprisePolicySinglePageAsync(String resourceGroupName, String enterprisePolicyName) { + 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 (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByEnterprisePolicy(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, this.client.getApiVersion(), enterprisePolicyName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources that need to be created for enterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for enterprisePolicy along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByEnterprisePolicySinglePageAsync(String resourceGroupName, String enterprisePolicyName, 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 (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByEnterprisePolicy(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), enterprisePolicyName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), null, null)); + } + + /** + * Gets the private link resources that need to be created for enterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for enterprisePolicy as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByEnterprisePolicyAsync(String resourceGroupName, + String enterprisePolicyName) { + return new PagedFlux<>(() -> listByEnterprisePolicySinglePageAsync(resourceGroupName, enterprisePolicyName)); + } + + /** + * Gets the private link resources that need to be created for enterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for enterprisePolicy as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByEnterprisePolicyAsync(String resourceGroupName, + String enterprisePolicyName, Context context) { + return new PagedFlux<>( + () -> listByEnterprisePolicySinglePageAsync(resourceGroupName, enterprisePolicyName, context)); + } + + /** + * Gets the private link resources that need to be created for enterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for enterprisePolicy as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName) { + return new PagedIterable<>(listByEnterprisePolicyAsync(resourceGroupName, enterprisePolicyName)); + } + + /** + * Gets the private link resources that need to be created for enterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for enterprisePolicy as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName, Context context) { + return new PagedIterable<>(listByEnterprisePolicyAsync(resourceGroupName, enterprisePolicyName, context)); + } + + /** + * Gets the private link resources that need to be created for an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for an EnterprisePolicy along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String enterprisePolicyName, String groupName) { + 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 (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, this.client.getApiVersion(), enterprisePolicyName, groupName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources that need to be created for an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for an EnterprisePolicy along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String enterprisePolicyName, String groupName, 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 (enterprisePolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enterprisePolicyName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), enterprisePolicyName, groupName, accept, context); + } + + /** + * Gets the private link resources that need to be created for an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for an EnterprisePolicy on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String enterprisePolicyName, + String groupName) { + return getWithResponseAsync(resourceGroupName, enterprisePolicyName, groupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the private link resources that need to be created for an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for an EnterprisePolicy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String enterprisePolicyName, + String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, enterprisePolicyName, groupName, context).block(); + } + + /** + * Gets the private link resources that need to be created for an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for an EnterprisePolicy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner get(String resourceGroupName, String enterprisePolicyName, String groupName) { + return getWithResponse(resourceGroupName, enterprisePolicyName, groupName, Context.NONE).getValue(); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateLinkResourcesImpl.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 000000000000..277efa86a8d2 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.powerplatform.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.powerplatform.models.PrivateLinkResource; +import com.azure.resourcemanager.powerplatform.models.PrivateLinkResources; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager; + + public PrivateLinkResourcesImpl(PrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.powerplatform.PowerPlatformManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName) { + PagedIterable inner + = this.serviceClient().listByEnterprisePolicy(resourceGroupName, enterprisePolicyName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName, Context context) { + PagedIterable inner + = this.serviceClient().listByEnterprisePolicy(resourceGroupName, enterprisePolicyName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String enterprisePolicyName, + String groupName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, enterprisePolicyName, groupName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PrivateLinkResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateLinkResource get(String resourceGroupName, String enterprisePolicyName, String groupName) { + PrivateLinkResourceInner inner = this.serviceClient().get(resourceGroupName, enterprisePolicyName, groupName); + if (inner != null) { + return new PrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.powerplatform.PowerPlatformManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/ResourceManagerUtils.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..031f314dc877 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/package-info.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/package-info.java new file mode 100644 index 000000000000..1e8c19e83744 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for PowerPlatform. + * null. + */ +package com.azure.resourcemanager.powerplatform.implementation; diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Account.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Account.java new file mode 100644 index 000000000000..2ba4796a6be3 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Account.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.powerplatform.fluent.models.AccountInner; +import java.util.Map; + +/** + * An immutable client-side representation of Account. + */ +public interface Account { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the systemId property: The internally assigned unique identifier of the resource. + * + * @return the systemId value. + */ + String systemId(); + + /** + * Gets the description property: The description of the account. + * + * @return the description value. + */ + String description(); + + /** + * 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.powerplatform.fluent.models.AccountInner object. + * + * @return the inner object. + */ + AccountInner innerModel(); + + /** + * The entirety of the Account definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The Account definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Account definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Account 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 Account 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 Account 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.WithDescription { + /** + * Executes the create request. + * + * @return the created resource. + */ + Account create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Account create(Context context); + } + + /** + * The stage of the Account 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 Account definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The description of the account.. + * + * @param description The description of the account. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + } + + /** + * Begins update for the Account resource. + * + * @return the stage of resource update. + */ + Account.Update update(); + + /** + * The template for Account update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithDescription { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Account apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Account apply(Context context); + } + + /** + * The Account update stages. + */ + interface UpdateStages { + /** + * The stage of the Account 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 Account update allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The description of the account.. + * + * @param description The description of the account. + * @return the next definition stage. + */ + Update withDescription(String description); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Account refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Account refresh(Context context); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/AccountList.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/AccountList.java new file mode 100644 index 000000000000..41826f78854d --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/AccountList.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.powerplatform.fluent.models.AccountInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of the list accounts operation. + */ +@Fluent +public final class AccountList implements JsonSerializable { + /* + * Result of the list accounts operation. + */ + private List value; + + /* + * Next page link if any. + */ + private String nextLink; + + /** + * Creates an instance of AccountList class. + */ + public AccountList() { + } + + /** + * Get the value property: Result of the list accounts operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Result of the list accounts operation. + * + * @param value the value value to set. + * @return the AccountList object itself. + */ + public AccountList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Next page link if any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Next page link if any. + * + * @param nextLink the nextLink value to set. + * @return the AccountList object itself. + */ + public AccountList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@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 AccountList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccountList 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 AccountList. + */ + public static AccountList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AccountList deserializedAccountList = new AccountList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> AccountInner.fromJson(reader1)); + deserializedAccountList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAccountList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAccountList; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Accounts.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Accounts.java new file mode 100644 index 000000000000..fd2ef6a0522f --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Accounts.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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 Accounts. + */ +public interface Accounts { + /** + * Get information about an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @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 information about an account along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Get information about an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about an account. + */ + Account getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Delete an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @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 Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Delete an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 accountName); + + /** + * Retrieve a list of accounts within a given 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 the list accounts operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieve a list of accounts within a given 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 the list accounts operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieve a list of accounts within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list accounts operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Retrieve a list of accounts within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list accounts operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get information about an account. + * + * @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 information about an account along with {@link Response}. + */ + Account getById(String id); + + /** + * Get information about an account. + * + * @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 information about an account along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an account. + * + * @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 account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Account resource. + * + * @param name resource name. + * @return the first stage of the new Account definition. + */ + Account.DefinitionStages.Blank define(String name); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/ActionType.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/ActionType.java new file mode 100644 index 000000000000..3728890b296d --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicies.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicies.java new file mode 100644 index 000000000000..90295eb96ba9 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicies.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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 EnterprisePolicies. + */ +public interface EnterprisePolicies { + /** + * Get information about an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName The EnterprisePolicy 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 information about an EnterprisePolicy along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String enterprisePolicyName, + Context context); + + /** + * Get information about an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName The EnterprisePolicy 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 information about an EnterprisePolicy. + */ + EnterprisePolicy getByResourceGroup(String resourceGroupName, String enterprisePolicyName); + + /** + * Delete an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @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 Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String enterprisePolicyName, + Context context); + + /** + * Delete an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName Name of the EnterprisePolicy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 enterprisePolicyName); + + /** + * Retrieve a list of EnterprisePolicies within a given 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 the list EnterprisePolicy operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieve a list of EnterprisePolicies within a given 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 the list EnterprisePolicy operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieve a list of EnterprisePolicies within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list EnterprisePolicy operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Retrieve a list of EnterprisePolicies within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of the list EnterprisePolicy operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get information about an EnterprisePolicy. + * + * @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 information about an EnterprisePolicy along with {@link Response}. + */ + EnterprisePolicy getById(String id); + + /** + * Get information about an EnterprisePolicy. + * + * @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 information about an EnterprisePolicy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an EnterprisePolicy. + * + * @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 EnterprisePolicy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new EnterprisePolicy resource. + * + * @param name resource name. + * @return the first stage of the new EnterprisePolicy definition. + */ + EnterprisePolicy.DefinitionStages.Blank define(String name); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicy.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicy.java new file mode 100644 index 000000000000..ae03b8bfdaf2 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicy.java @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.powerplatform.fluent.models.EnterprisePolicyInner; +import java.util.Map; + +/** + * An immutable client-side representation of EnterprisePolicy. + */ +public interface EnterprisePolicy { + /** + * 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 identity property: The identity of the EnterprisePolicy. + * + * @return the identity value. + */ + EnterprisePolicyIdentity identity(); + + /** + * Gets the kind property: The kind (type) of Enterprise Policy. + * + * @return the kind value. + */ + EnterprisePolicyKind kind(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the systemId property: The internally assigned unique identifier of the resource. + * + * @return the systemId value. + */ + String systemId(); + + /** + * Gets the lockbox property: Settings concerning lockbox. + * + * @return the lockbox value. + */ + PropertiesLockbox lockbox(); + + /** + * Gets the encryption property: The encryption settings for a configuration store. + * + * @return the encryption value. + */ + PropertiesEncryption encryption(); + + /** + * Gets the networkInjection property: Settings concerning network injection. + * + * @return the networkInjection value. + */ + PropertiesNetworkInjection networkInjection(); + + /** + * Gets the healthStatus property: The health status of the resource. + * + * @return the healthStatus value. + */ + HealthStatus healthStatus(); + + /** + * 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.powerplatform.fluent.models.EnterprisePolicyInner object. + * + * @return the inner object. + */ + EnterprisePolicyInner innerModel(); + + /** + * The entirety of the EnterprisePolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithKind, DefinitionStages.WithCreate { + } + + /** + * The EnterprisePolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the EnterprisePolicy definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the EnterprisePolicy 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 EnterprisePolicy 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. + */ + WithKind withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the EnterprisePolicy definition allowing to specify kind. + */ + interface WithKind { + /** + * Specifies the kind property: The kind (type) of Enterprise Policy.. + * + * @param kind The kind (type) of Enterprise Policy. + * @return the next definition stage. + */ + WithCreate withKind(EnterprisePolicyKind kind); + } + + /** + * The stage of the EnterprisePolicy 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.WithIdentity, DefinitionStages.WithLockbox, + DefinitionStages.WithEncryption, DefinitionStages.WithNetworkInjection, DefinitionStages.WithHealthStatus { + /** + * Executes the create request. + * + * @return the created resource. + */ + EnterprisePolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + EnterprisePolicy create(Context context); + } + + /** + * The stage of the EnterprisePolicy 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 EnterprisePolicy definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the EnterprisePolicy.. + * + * @param identity The identity of the EnterprisePolicy. + * @return the next definition stage. + */ + WithCreate withIdentity(EnterprisePolicyIdentity identity); + } + + /** + * The stage of the EnterprisePolicy definition allowing to specify lockbox. + */ + interface WithLockbox { + /** + * Specifies the lockbox property: Settings concerning lockbox.. + * + * @param lockbox Settings concerning lockbox. + * @return the next definition stage. + */ + WithCreate withLockbox(PropertiesLockbox lockbox); + } + + /** + * The stage of the EnterprisePolicy definition allowing to specify encryption. + */ + interface WithEncryption { + /** + * Specifies the encryption property: The encryption settings for a configuration store.. + * + * @param encryption The encryption settings for a configuration store. + * @return the next definition stage. + */ + WithCreate withEncryption(PropertiesEncryption encryption); + } + + /** + * The stage of the EnterprisePolicy definition allowing to specify networkInjection. + */ + interface WithNetworkInjection { + /** + * Specifies the networkInjection property: Settings concerning network injection.. + * + * @param networkInjection Settings concerning network injection. + * @return the next definition stage. + */ + WithCreate withNetworkInjection(PropertiesNetworkInjection networkInjection); + } + + /** + * The stage of the EnterprisePolicy definition allowing to specify healthStatus. + */ + interface WithHealthStatus { + /** + * Specifies the healthStatus property: The health status of the resource.. + * + * @param healthStatus The health status of the resource. + * @return the next definition stage. + */ + WithCreate withHealthStatus(HealthStatus healthStatus); + } + } + + /** + * Begins update for the EnterprisePolicy resource. + * + * @return the stage of resource update. + */ + EnterprisePolicy.Update update(); + + /** + * The template for EnterprisePolicy update. + */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithKind, UpdateStages.WithLockbox, + UpdateStages.WithEncryption, UpdateStages.WithNetworkInjection, UpdateStages.WithHealthStatus { + /** + * Executes the update request. + * + * @return the updated resource. + */ + EnterprisePolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + EnterprisePolicy apply(Context context); + } + + /** + * The EnterprisePolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the EnterprisePolicy 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 EnterprisePolicy update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the EnterprisePolicy.. + * + * @param identity The identity of the EnterprisePolicy. + * @return the next definition stage. + */ + Update withIdentity(EnterprisePolicyIdentity identity); + } + + /** + * The stage of the EnterprisePolicy update allowing to specify kind. + */ + interface WithKind { + /** + * Specifies the kind property: The kind (type) of Enterprise Policy.. + * + * @param kind The kind (type) of Enterprise Policy. + * @return the next definition stage. + */ + Update withKind(EnterprisePolicyKind kind); + } + + /** + * The stage of the EnterprisePolicy update allowing to specify lockbox. + */ + interface WithLockbox { + /** + * Specifies the lockbox property: Settings concerning lockbox.. + * + * @param lockbox Settings concerning lockbox. + * @return the next definition stage. + */ + Update withLockbox(PropertiesLockbox lockbox); + } + + /** + * The stage of the EnterprisePolicy update allowing to specify encryption. + */ + interface WithEncryption { + /** + * Specifies the encryption property: The encryption settings for a configuration store.. + * + * @param encryption The encryption settings for a configuration store. + * @return the next definition stage. + */ + Update withEncryption(PropertiesEncryption encryption); + } + + /** + * The stage of the EnterprisePolicy update allowing to specify networkInjection. + */ + interface WithNetworkInjection { + /** + * Specifies the networkInjection property: Settings concerning network injection.. + * + * @param networkInjection Settings concerning network injection. + * @return the next definition stage. + */ + Update withNetworkInjection(PropertiesNetworkInjection networkInjection); + } + + /** + * The stage of the EnterprisePolicy update allowing to specify healthStatus. + */ + interface WithHealthStatus { + /** + * Specifies the healthStatus property: The health status of the resource.. + * + * @param healthStatus The health status of the resource. + * @return the next definition stage. + */ + Update withHealthStatus(HealthStatus healthStatus); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + EnterprisePolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + EnterprisePolicy refresh(Context context); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicyIdentity.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicyIdentity.java new file mode 100644 index 000000000000..f624aaf4ac5f --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicyIdentity.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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; + +/** + * The identity of the EnterprisePolicy. + */ +@Fluent +public final class EnterprisePolicyIdentity implements JsonSerializable { + /* + * The principal id of EnterprisePolicy identity. + */ + private String systemAssignedIdentityPrincipalId; + + /* + * The tenant id associated with the EnterprisePolicy. + */ + private String tenantId; + + /* + * The type of identity used for the EnterprisePolicy. Currently, the only supported type is 'SystemAssigned', which + * implicitly creates an identity. + */ + private ResourceIdentityType type; + + /** + * Creates an instance of EnterprisePolicyIdentity class. + */ + public EnterprisePolicyIdentity() { + } + + /** + * Get the systemAssignedIdentityPrincipalId property: The principal id of EnterprisePolicy identity. + * + * @return the systemAssignedIdentityPrincipalId value. + */ + public String systemAssignedIdentityPrincipalId() { + return this.systemAssignedIdentityPrincipalId; + } + + /** + * Get the tenantId property: The tenant id associated with the EnterprisePolicy. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of identity used for the EnterprisePolicy. Currently, the only supported type is + * 'SystemAssigned', which implicitly creates an identity. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of identity used for the EnterprisePolicy. Currently, the only supported type is + * 'SystemAssigned', which implicitly creates an identity. + * + * @param type the type value to set. + * @return the EnterprisePolicyIdentity object itself. + */ + public EnterprisePolicyIdentity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnterprisePolicyIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnterprisePolicyIdentity 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 EnterprisePolicyIdentity. + */ + public static EnterprisePolicyIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnterprisePolicyIdentity deserializedEnterprisePolicyIdentity = new EnterprisePolicyIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("systemAssignedIdentityPrincipalId".equals(fieldName)) { + deserializedEnterprisePolicyIdentity.systemAssignedIdentityPrincipalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedEnterprisePolicyIdentity.tenantId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEnterprisePolicyIdentity.type = ResourceIdentityType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedEnterprisePolicyIdentity; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicyKind.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicyKind.java new file mode 100644 index 000000000000..4647bb269085 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicyKind.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Kind (type) of Enterprise Policy. + */ +public final class EnterprisePolicyKind extends ExpandableStringEnum { + /** + * Static value Lockbox for EnterprisePolicyKind. + */ + public static final EnterprisePolicyKind LOCKBOX = fromString("Lockbox"); + + /** + * Static value PrivateEndpoint for EnterprisePolicyKind. + */ + public static final EnterprisePolicyKind PRIVATE_ENDPOINT = fromString("PrivateEndpoint"); + + /** + * Static value Encryption for EnterprisePolicyKind. + */ + public static final EnterprisePolicyKind ENCRYPTION = fromString("Encryption"); + + /** + * Static value NetworkInjection for EnterprisePolicyKind. + */ + public static final EnterprisePolicyKind NETWORK_INJECTION = fromString("NetworkInjection"); + + /** + * Static value Identity for EnterprisePolicyKind. + */ + public static final EnterprisePolicyKind IDENTITY = fromString("Identity"); + + /** + * Creates a new instance of EnterprisePolicyKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EnterprisePolicyKind() { + } + + /** + * Creates or finds a EnterprisePolicyKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnterprisePolicyKind. + */ + public static EnterprisePolicyKind fromString(String name) { + return fromString(name, EnterprisePolicyKind.class); + } + + /** + * Gets known EnterprisePolicyKind values. + * + * @return known EnterprisePolicyKind values. + */ + public static Collection values() { + return values(EnterprisePolicyKind.class); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicyList.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicyList.java new file mode 100644 index 000000000000..47dab8469aec --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/EnterprisePolicyList.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.powerplatform.fluent.models.EnterprisePolicyInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of the list EnterprisePolicy operation. + */ +@Fluent +public final class EnterprisePolicyList implements JsonSerializable { + /* + * Result of the list EnterprisePolicy operation. + */ + private List value; + + /* + * Next page link if any. + */ + private String nextLink; + + /** + * Creates an instance of EnterprisePolicyList class. + */ + public EnterprisePolicyList() { + } + + /** + * Get the value property: Result of the list EnterprisePolicy operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Result of the list EnterprisePolicy operation. + * + * @param value the value value to set. + * @return the EnterprisePolicyList object itself. + */ + public EnterprisePolicyList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Next page link if any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Next page link if any. + * + * @param nextLink the nextLink value to set. + * @return the EnterprisePolicyList object itself. + */ + public EnterprisePolicyList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@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 EnterprisePolicyList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnterprisePolicyList 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 EnterprisePolicyList. + */ + public static EnterprisePolicyList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnterprisePolicyList deserializedEnterprisePolicyList = new EnterprisePolicyList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> EnterprisePolicyInner.fromJson(reader1)); + deserializedEnterprisePolicyList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedEnterprisePolicyList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnterprisePolicyList; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/HealthStatus.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/HealthStatus.java new file mode 100644 index 000000000000..069878fd2a3a --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/HealthStatus.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The health status of the resource. + */ +public final class HealthStatus extends ExpandableStringEnum { + /** + * Static value Undetermined for HealthStatus. + */ + public static final HealthStatus UNDETERMINED = fromString("Undetermined"); + + /** + * Static value Healthy for HealthStatus. + */ + public static final HealthStatus HEALTHY = fromString("Healthy"); + + /** + * Static value Warning for HealthStatus. + */ + public static final HealthStatus WARNING = fromString("Warning"); + + /** + * Static value Unhealthy for HealthStatus. + */ + public static final HealthStatus UNHEALTHY = fromString("Unhealthy"); + + /** + * Creates a new instance of HealthStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public HealthStatus() { + } + + /** + * Creates or finds a HealthStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding HealthStatus. + */ + public static HealthStatus fromString(String name) { + return fromString(name, HealthStatus.class); + } + + /** + * Gets known HealthStatus values. + * + * @return known HealthStatus values. + */ + public static Collection values() { + return values(HealthStatus.class); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/KeyProperties.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/KeyProperties.java new file mode 100644 index 000000000000..ff9a0e5c4a9c --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/KeyProperties.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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; + +/** + * Url and version of the KeyVault Secret. + */ +@Fluent +public final class KeyProperties implements JsonSerializable { + /* + * The identifier of the key vault key used to encrypt data. + */ + private String name; + + /* + * The version of the identity which will be used to access key vault. + */ + private String version; + + /** + * Creates an instance of KeyProperties class. + */ + public KeyProperties() { + } + + /** + * Get the name property: The identifier of the key vault key used to encrypt data. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The identifier of the key vault key used to encrypt data. + * + * @param name the name value to set. + * @return the KeyProperties object itself. + */ + public KeyProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the version property: The version of the identity which will be used to access key vault. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the identity which will be used to access key vault. + * + * @param version the version value to set. + * @return the KeyProperties object itself. + */ + public KeyProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("version", this.version); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KeyProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KeyProperties 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 KeyProperties. + */ + public static KeyProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KeyProperties deserializedKeyProperties = new KeyProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedKeyProperties.name = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedKeyProperties.version = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKeyProperties; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/KeyVaultProperties.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/KeyVaultProperties.java new file mode 100644 index 000000000000..477742fa709d --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/KeyVaultProperties.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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; + +/** + * Settings concerning key vault encryption for a configuration store. + */ +@Fluent +public final class KeyVaultProperties implements JsonSerializable { + /* + * Uri of KeyVault + */ + private String id; + + /* + * Identity of the secret that includes name and version. + */ + private KeyProperties key; + + /** + * Creates an instance of KeyVaultProperties class. + */ + public KeyVaultProperties() { + } + + /** + * Get the id property: Uri of KeyVault. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Uri of KeyVault. + * + * @param id the id value to set. + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withId(String id) { + this.id = id; + return this; + } + + /** + * Get the key property: Identity of the secret that includes name and version. + * + * @return the key value. + */ + public KeyProperties key() { + return this.key; + } + + /** + * Set the key property: Identity of the secret that includes name and version. + * + * @param key the key value to set. + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKey(KeyProperties key) { + this.key = key; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (key() != null) { + key().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeJsonField("key", this.key); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KeyVaultProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KeyVaultProperties 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 KeyVaultProperties. + */ + public static KeyVaultProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KeyVaultProperties deserializedKeyVaultProperties = new KeyVaultProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedKeyVaultProperties.id = reader.getString(); + } else if ("key".equals(fieldName)) { + deserializedKeyVaultProperties.key = KeyProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKeyVaultProperties; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Operation.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Operation.java new file mode 100644 index 000000000000..7c7d519d4715 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.resourcemanager.powerplatform.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.powerplatform.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/OperationDisplay.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/OperationDisplay.java new file mode 100644 index 000000000000..cf2e490cc549 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/OperationListResult.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/OperationListResult.java new file mode 100644 index 000000000000..476188d73a22 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/OperationListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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.powerplatform.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * List of operations supported by the resource provider + */ + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Operations.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Operations.java new file mode 100644 index 000000000000..e38158e92f8b --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * Lists all of the available PowerPlatform REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all of the available PowerPlatform REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Origin.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Origin.java new file mode 100644 index 000000000000..dbf6d5e9e9dc --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Static value user for Origin. + */ + public static final Origin USER = fromString("user"); + + /** + * Static value system for Origin. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Static value user,system for Origin. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PatchAccount.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PatchAccount.java new file mode 100644 index 000000000000..de56ec192742 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PatchAccount.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.annotation.Fluent; +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.powerplatform.fluent.models.AccountProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Definition of the account. + */ +@Fluent +public final class PatchAccount extends PatchTrackedResource { + /* + * The properties that define configuration for the account. + */ + private AccountProperties innerProperties; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + 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 PatchAccount class. + */ + public PatchAccount() { + } + + /** + * Get the innerProperties property: The properties that define configuration for the account. + * + * @return the innerProperties value. + */ + private AccountProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @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 PatchAccount withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PatchAccount withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * Get the systemId property: The internally assigned unique identifier of the resource. + * + * @return the systemId value. + */ + public String systemId() { + return this.innerProperties() == null ? null : this.innerProperties().systemId(); + } + + /** + * Get the description property: The description of the account. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the account. + * + * @param description the description value to set. + * @return the PatchAccount object itself. + */ + public PatchAccount withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PatchAccount from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PatchAccount 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 PatchAccount. + */ + public static PatchAccount fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PatchAccount deserializedPatchAccount = new PatchAccount(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPatchAccount.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPatchAccount.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPatchAccount.type = reader.getString(); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPatchAccount.withTags(tags); + } else if ("location".equals(fieldName)) { + deserializedPatchAccount.withLocation(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedPatchAccount.innerProperties = AccountProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPatchAccount.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPatchAccount; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PatchEnterprisePolicy.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PatchEnterprisePolicy.java new file mode 100644 index 000000000000..63ad6c3b8051 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PatchEnterprisePolicy.java @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.annotation.Fluent; +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.powerplatform.fluent.models.Properties; +import java.io.IOException; +import java.util.Map; + +/** + * Definition of the EnterprisePolicy. + */ +@Fluent +public final class PatchEnterprisePolicy extends PatchTrackedResource { + /* + * The identity of the EnterprisePolicy. + */ + private EnterprisePolicyIdentity identity; + + /* + * The kind (type) of Enterprise Policy. + */ + private EnterprisePolicyKind kind; + + /* + * The properties that define configuration for the enterprise policy + */ + private Properties innerProperties; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + 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 PatchEnterprisePolicy class. + */ + public PatchEnterprisePolicy() { + } + + /** + * Get the identity property: The identity of the EnterprisePolicy. + * + * @return the identity value. + */ + public EnterprisePolicyIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the EnterprisePolicy. + * + * @param identity the identity value to set. + * @return the PatchEnterprisePolicy object itself. + */ + public PatchEnterprisePolicy withIdentity(EnterprisePolicyIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the kind property: The kind (type) of Enterprise Policy. + * + * @return the kind value. + */ + public EnterprisePolicyKind kind() { + return this.kind; + } + + /** + * Set the kind property: The kind (type) of Enterprise Policy. + * + * @param kind the kind value to set. + * @return the PatchEnterprisePolicy object itself. + */ + public PatchEnterprisePolicy withKind(EnterprisePolicyKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the innerProperties property: The properties that define configuration for the enterprise policy. + * + * @return the innerProperties value. + */ + private Properties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @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 PatchEnterprisePolicy withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PatchEnterprisePolicy withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * Get the systemId property: The internally assigned unique identifier of the resource. + * + * @return the systemId value. + */ + public String systemId() { + return this.innerProperties() == null ? null : this.innerProperties().systemId(); + } + + /** + * Get the lockbox property: Settings concerning lockbox. + * + * @return the lockbox value. + */ + public PropertiesLockbox lockbox() { + return this.innerProperties() == null ? null : this.innerProperties().lockbox(); + } + + /** + * Set the lockbox property: Settings concerning lockbox. + * + * @param lockbox the lockbox value to set. + * @return the PatchEnterprisePolicy object itself. + */ + public PatchEnterprisePolicy withLockbox(PropertiesLockbox lockbox) { + if (this.innerProperties() == null) { + this.innerProperties = new Properties(); + } + this.innerProperties().withLockbox(lockbox); + return this; + } + + /** + * Get the encryption property: The encryption settings for a configuration store. + * + * @return the encryption value. + */ + public PropertiesEncryption encryption() { + return this.innerProperties() == null ? null : this.innerProperties().encryption(); + } + + /** + * Set the encryption property: The encryption settings for a configuration store. + * + * @param encryption the encryption value to set. + * @return the PatchEnterprisePolicy object itself. + */ + public PatchEnterprisePolicy withEncryption(PropertiesEncryption encryption) { + if (this.innerProperties() == null) { + this.innerProperties = new Properties(); + } + this.innerProperties().withEncryption(encryption); + return this; + } + + /** + * Get the networkInjection property: Settings concerning network injection. + * + * @return the networkInjection value. + */ + public PropertiesNetworkInjection networkInjection() { + return this.innerProperties() == null ? null : this.innerProperties().networkInjection(); + } + + /** + * Set the networkInjection property: Settings concerning network injection. + * + * @param networkInjection the networkInjection value to set. + * @return the PatchEnterprisePolicy object itself. + */ + public PatchEnterprisePolicy withNetworkInjection(PropertiesNetworkInjection networkInjection) { + if (this.innerProperties() == null) { + this.innerProperties = new Properties(); + } + this.innerProperties().withNetworkInjection(networkInjection); + return this; + } + + /** + * Get the healthStatus property: The health status of the resource. + * + * @return the healthStatus value. + */ + public HealthStatus healthStatus() { + return this.innerProperties() == null ? null : this.innerProperties().healthStatus(); + } + + /** + * Set the healthStatus property: The health status of the resource. + * + * @param healthStatus the healthStatus value to set. + * @return the PatchEnterprisePolicy object itself. + */ + public PatchEnterprisePolicy withHealthStatus(HealthStatus healthStatus) { + if (this.innerProperties() == null) { + this.innerProperties = new Properties(); + } + this.innerProperties().withHealthStatus(healthStatus); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PatchEnterprisePolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PatchEnterprisePolicy 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 PatchEnterprisePolicy. + */ + public static PatchEnterprisePolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PatchEnterprisePolicy deserializedPatchEnterprisePolicy = new PatchEnterprisePolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPatchEnterprisePolicy.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPatchEnterprisePolicy.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPatchEnterprisePolicy.type = reader.getString(); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPatchEnterprisePolicy.withTags(tags); + } else if ("location".equals(fieldName)) { + deserializedPatchEnterprisePolicy.withLocation(reader.getString()); + } else if ("identity".equals(fieldName)) { + deserializedPatchEnterprisePolicy.identity = EnterprisePolicyIdentity.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedPatchEnterprisePolicy.kind = EnterprisePolicyKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedPatchEnterprisePolicy.innerProperties = Properties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPatchEnterprisePolicy.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPatchEnterprisePolicy; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PatchTrackedResource.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PatchTrackedResource.java new file mode 100644 index 000000000000..ef5e2389dfe3 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PatchTrackedResource.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a + * 'location'. + */ +@Fluent +public class PatchTrackedResource extends ProxyResource { + /* + * Resource tags. + */ + private Map tags; + + /* + * The geo-location where the resource lives + */ + private String location; + + /* + * 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 PatchTrackedResource class. + */ + public PatchTrackedResource() { + } + + /** + * 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 PatchTrackedResource object itself. + */ + public PatchTrackedResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the PatchTrackedResource object itself. + */ + public PatchTrackedResource withLocation(String location) { + this.location = location; + return this; + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PatchTrackedResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PatchTrackedResource 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 PatchTrackedResource. + */ + public static PatchTrackedResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PatchTrackedResource deserializedPatchTrackedResource = new PatchTrackedResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPatchTrackedResource.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPatchTrackedResource.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPatchTrackedResource.type = reader.getString(); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPatchTrackedResource.tags = tags; + } else if ("location".equals(fieldName)) { + deserializedPatchTrackedResource.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPatchTrackedResource; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpoint.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpoint.java new file mode 100644 index 000000000000..dd428c59b226 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpoint.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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; + +/** + * The Private Endpoint resource. + */ +@Immutable +public final class PrivateEndpoint implements JsonSerializable { + /* + * The ARM identifier for Private Endpoint + */ + private String id; + + /** + * Creates an instance of PrivateEndpoint class. + */ + public PrivateEndpoint() { + } + + /** + * Get the id property: The ARM identifier for Private Endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * 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 PrivateEndpoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpoint 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 PrivateEndpoint. + */ + public static PrivateEndpoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpoint deserializedPrivateEndpoint = new PrivateEndpoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpoint.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpoint; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointConnection.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointConnection.java new file mode 100644 index 000000000000..05a1d31ff460 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointConnection.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.powerplatform.fluent.models.PrivateEndpointConnectionInner; + +/** + * An immutable client-side representation of PrivateEndpointConnection. + */ +public interface PrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the privateEndpoint property: The resource of private end point. + * + * @return the privateEndpoint value. + */ + PrivateEndpoint privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: A collection of information about the state of the + * connection between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionState privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + PrivateEndpointConnectionProvisioningState provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.powerplatform.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** + * The entirety of the PrivateEndpointConnection definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The PrivateEndpointConnection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the PrivateEndpointConnection definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the PrivateEndpointConnection definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, enterprisePolicyName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @return the next definition stage. + */ + WithCreate withExistingEnterprisePolicy(String resourceGroupName, String enterprisePolicyName); + } + + /** + * The stage of the PrivateEndpointConnection 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.WithPrivateEndpoint, DefinitionStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateEndpoint. + */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: The resource of private end point.. + * + * @param privateEndpoint The resource of private end point. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(PrivateEndpoint privateEndpoint); + } + + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: A collection of information about the state of + * the connection between service consumer and provider.. + * + * @param privateLinkServiceConnectionState A collection of information about the state of the connection + * between service consumer and provider. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState); + } + } + + /** + * Begins update for the PrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnection.Update update(); + + /** + * The template for PrivateEndpointConnection update. + */ + interface Update extends UpdateStages.WithPrivateEndpoint, UpdateStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnection apply(Context context); + } + + /** + * The PrivateEndpointConnection update stages. + */ + interface UpdateStages { + /** + * The stage of the PrivateEndpointConnection update allowing to specify privateEndpoint. + */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: The resource of private end point.. + * + * @param privateEndpoint The resource of private end point. + * @return the next definition stage. + */ + Update withPrivateEndpoint(PrivateEndpoint privateEndpoint); + } + + /** + * The stage of the PrivateEndpointConnection update allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: A collection of information about the state of + * the connection between service consumer and provider.. + * + * @param privateLinkServiceConnectionState A collection of information about the state of the connection + * between service consumer and provider. + * @return the next definition stage. + */ + Update withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointConnectionListResult.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 000000000000..bb3ee17820a7 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.powerplatform.fluent.models.PrivateEndpointConnectionInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of private endpoint connections. + */ +@Fluent +public final class PrivateEndpointConnectionListResult + implements JsonSerializable { + /* + * Array of private endpoint connections + */ + private List value; + + /** + * Creates an instance of PrivateEndpointConnectionListResult class. + */ + public PrivateEndpointConnectionListResult() { + } + + /** + * Get the value property: Array of private endpoint connections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private endpoint connections. + * + * @param value the value value to set. + * @return the PrivateEndpointConnectionListResult object itself. + */ + public PrivateEndpointConnectionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionListResult 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 PrivateEndpointConnectionListResult. + */ + public static PrivateEndpointConnectionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionListResult deserializedPrivateEndpointConnectionListResult + = new PrivateEndpointConnectionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateEndpointConnectionInner.fromJson(reader1)); + deserializedPrivateEndpointConnectionListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionListResult; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointConnectionProvisioningState.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 000000000000..0214cb4b58b4 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The current provisioning state. + */ +public final class PrivateEndpointConnectionProvisioningState + extends ExpandableStringEnum { + /** + * Static value Succeeded for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Creating for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState CREATING = fromString("Creating"); + + /** + * Static value Deleting for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Failed for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState FAILED = fromString("Failed"); + + /** + * Creates a new instance of PrivateEndpointConnectionProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointConnectionProvisioningState() { + } + + /** + * Creates or finds a PrivateEndpointConnectionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointConnectionProvisioningState. + */ + public static PrivateEndpointConnectionProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointConnectionProvisioningState.class); + } + + /** + * Gets known PrivateEndpointConnectionProvisioningState values. + * + * @return known PrivateEndpointConnectionProvisioningState values. + */ + public static Collection values() { + return values(PrivateEndpointConnectionProvisioningState.class); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointConnections.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointConnections.java new file mode 100644 index 000000000000..ac4a17fb69e6 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointConnections.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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 PrivateEndpointConnections. + */ +public interface PrivateEndpointConnections { + /** + * List all private endpoint connections on an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 private endpoint connections as paginated response with {@link PagedIterable}. + */ + PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName); + + /** + * List all private endpoint connections on an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections as paginated response with {@link PagedIterable}. + */ + PagedIterable listByEnterprisePolicy(String resourceGroupName, + String enterprisePolicyName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + PrivateEndpointConnection get(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String enterprisePolicyName, + String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String enterprisePolicyName, String privateEndpointConnectionName); + + /** + * Gets a private endpoint 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 a private endpoint connection along with {@link Response}. + */ + PrivateEndpointConnection getById(String id); + + /** + * Gets a private endpoint 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 a private endpoint connection along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointServiceConnectionStatus.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointServiceConnectionStatus.java new file mode 100644 index 000000000000..8cafdd966c0f --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateEndpointServiceConnectionStatus.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The private endpoint connection status. + */ +public final class PrivateEndpointServiceConnectionStatus + extends ExpandableStringEnum { + /** + * Static value Pending for PrivateEndpointServiceConnectionStatus. + */ + public static final PrivateEndpointServiceConnectionStatus PENDING = fromString("Pending"); + + /** + * Static value Approved for PrivateEndpointServiceConnectionStatus. + */ + public static final PrivateEndpointServiceConnectionStatus APPROVED = fromString("Approved"); + + /** + * Static value Rejected for PrivateEndpointServiceConnectionStatus. + */ + public static final PrivateEndpointServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** + * Creates a new instance of PrivateEndpointServiceConnectionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointServiceConnectionStatus() { + } + + /** + * Creates or finds a PrivateEndpointServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointServiceConnectionStatus. + */ + public static PrivateEndpointServiceConnectionStatus fromString(String name) { + return fromString(name, PrivateEndpointServiceConnectionStatus.class); + } + + /** + * Gets known PrivateEndpointServiceConnectionStatus values. + * + * @return known PrivateEndpointServiceConnectionStatus values. + */ + public static Collection values() { + return values(PrivateEndpointServiceConnectionStatus.class); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateLinkResource.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateLinkResource.java new file mode 100644 index 000000000000..cb7376132176 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateLinkResource.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.resourcemanager.powerplatform.fluent.models.PrivateLinkResourceInner; +import java.util.List; + +/** + * An immutable client-side representation of PrivateLinkResource. + */ +public interface PrivateLinkResource { + /** + * 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 groupId property: The private link resource group id. + * + * @return the groupId value. + */ + String groupId(); + + /** + * Gets the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + List requiredMembers(); + + /** + * Gets the requiredZoneNames property: The private link resource Private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + List requiredZoneNames(); + + /** + * Gets the inner com.azure.resourcemanager.powerplatform.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateLinkResourceListResult.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateLinkResourceListResult.java new file mode 100644 index 000000000000..0c367a404410 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateLinkResourceListResult.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.powerplatform.fluent.models.PrivateLinkResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of private link resources. + */ +@Fluent +public final class PrivateLinkResourceListResult implements JsonSerializable { + /* + * Array of private link resources + */ + private List value; + + /** + * Creates an instance of PrivateLinkResourceListResult class. + */ + public PrivateLinkResourceListResult() { + } + + /** + * Get the value property: Array of private link resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private link resources. + * + * @param value the value value to set. + * @return the PrivateLinkResourceListResult object itself. + */ + public PrivateLinkResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceListResult 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 PrivateLinkResourceListResult. + */ + public static PrivateLinkResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceListResult deserializedPrivateLinkResourceListResult + = new PrivateLinkResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateLinkResourceInner.fromJson(reader1)); + deserializedPrivateLinkResourceListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceListResult; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateLinkResources.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateLinkResources.java new file mode 100644 index 000000000000..0c22e9b73aa2 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateLinkResources.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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 PrivateLinkResources. + */ +public interface PrivateLinkResources { + /** + * Gets the private link resources that need to be created for enterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for enterprisePolicy as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByEnterprisePolicy(String resourceGroupName, String enterprisePolicyName); + + /** + * Gets the private link resources that need to be created for enterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for enterprisePolicy as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByEnterprisePolicy(String resourceGroupName, String enterprisePolicyName, + Context context); + + /** + * Gets the private link resources that need to be created for an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for an EnterprisePolicy along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String enterprisePolicyName, + String groupName, Context context); + + /** + * Gets the private link resources that need to be created for an EnterprisePolicy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enterprisePolicyName EnterprisePolicy for the Microsoft Azure subscription. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for an EnterprisePolicy. + */ + PrivateLinkResource get(String resourceGroupName, String enterprisePolicyName, String groupName); +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateLinkServiceConnectionState.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 000000000000..a414112e1093 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PrivateLinkServiceConnectionState.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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; + +/** + * A collection of information about the state of the connection between service consumer and provider. + */ +@Fluent +public final class PrivateLinkServiceConnectionState implements JsonSerializable { + /* + * Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + */ + private PrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval/rejection of the connection. + */ + private String description; + + /* + * A message indicating if changes on the service provider require any updates on the consumer. + */ + private String actionsRequired; + + /** + * Creates an instance of PrivateLinkServiceConnectionState class. + */ + public PrivateLinkServiceConnectionState() { + } + + /** + * Get the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @return the status value. + */ + public PrivateEndpointServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withStatus(PrivateEndpointServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The reason for approval/rejection of the connection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The reason for approval/rejection of the connection. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Set the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @param actionsRequired the actionsRequired value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withActionsRequired(String actionsRequired) { + this.actionsRequired = actionsRequired; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("actionsRequired", this.actionsRequired); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkServiceConnectionState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkServiceConnectionState 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 PrivateLinkServiceConnectionState. + */ + public static PrivateLinkServiceConnectionState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkServiceConnectionState deserializedPrivateLinkServiceConnectionState + = new PrivateLinkServiceConnectionState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.status + = PrivateEndpointServiceConnectionStatus.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.description = reader.getString(); + } else if ("actionsRequired".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.actionsRequired = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkServiceConnectionState; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PropertiesEncryption.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PropertiesEncryption.java new file mode 100644 index 000000000000..852ae486d8bc --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PropertiesEncryption.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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; + +/** + * The encryption settings for a configuration store. + */ +@Fluent +public final class PropertiesEncryption implements JsonSerializable { + /* + * Key vault properties. + */ + private KeyVaultProperties keyVault; + + /* + * The state of onboarding, which only appears in the response. + */ + private State state; + + /** + * Creates an instance of PropertiesEncryption class. + */ + public PropertiesEncryption() { + } + + /** + * Get the keyVault property: Key vault properties. + * + * @return the keyVault value. + */ + public KeyVaultProperties keyVault() { + return this.keyVault; + } + + /** + * Set the keyVault property: Key vault properties. + * + * @param keyVault the keyVault value to set. + * @return the PropertiesEncryption object itself. + */ + public PropertiesEncryption withKeyVault(KeyVaultProperties keyVault) { + this.keyVault = keyVault; + return this; + } + + /** + * Get the state property: The state of onboarding, which only appears in the response. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Set the state property: The state of onboarding, which only appears in the response. + * + * @param state the state value to set. + * @return the PropertiesEncryption object itself. + */ + public PropertiesEncryption withState(State state) { + this.state = state; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyVault() != null) { + keyVault().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("keyVault", this.keyVault); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PropertiesEncryption from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PropertiesEncryption 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 PropertiesEncryption. + */ + public static PropertiesEncryption fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PropertiesEncryption deserializedPropertiesEncryption = new PropertiesEncryption(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyVault".equals(fieldName)) { + deserializedPropertiesEncryption.keyVault = KeyVaultProperties.fromJson(reader); + } else if ("state".equals(fieldName)) { + deserializedPropertiesEncryption.state = State.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPropertiesEncryption; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PropertiesLockbox.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PropertiesLockbox.java new file mode 100644 index 000000000000..a9508684fef0 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PropertiesLockbox.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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; + +/** + * Settings concerning lockbox. + */ +@Fluent +public final class PropertiesLockbox implements JsonSerializable { + /* + * lockbox configuration + */ + private State state; + + /** + * Creates an instance of PropertiesLockbox class. + */ + public PropertiesLockbox() { + } + + /** + * Get the state property: lockbox configuration. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Set the state property: lockbox configuration. + * + * @param state the state value to set. + * @return the PropertiesLockbox object itself. + */ + public PropertiesLockbox withState(State state) { + this.state = state; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PropertiesLockbox from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PropertiesLockbox 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 PropertiesLockbox. + */ + public static PropertiesLockbox fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PropertiesLockbox deserializedPropertiesLockbox = new PropertiesLockbox(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedPropertiesLockbox.state = State.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPropertiesLockbox; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PropertiesNetworkInjection.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PropertiesNetworkInjection.java new file mode 100644 index 000000000000..0385f0523023 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/PropertiesNetworkInjection.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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; + +/** + * Settings concerning network injection. + */ +@Fluent +public final class PropertiesNetworkInjection implements JsonSerializable { + /* + * Network injection configuration + */ + private VirtualNetworkPropertiesList virtualNetworks; + + /** + * Creates an instance of PropertiesNetworkInjection class. + */ + public PropertiesNetworkInjection() { + } + + /** + * Get the virtualNetworks property: Network injection configuration. + * + * @return the virtualNetworks value. + */ + public VirtualNetworkPropertiesList virtualNetworks() { + return this.virtualNetworks; + } + + /** + * Set the virtualNetworks property: Network injection configuration. + * + * @param virtualNetworks the virtualNetworks value to set. + * @return the PropertiesNetworkInjection object itself. + */ + public PropertiesNetworkInjection withVirtualNetworks(VirtualNetworkPropertiesList virtualNetworks) { + this.virtualNetworks = virtualNetworks; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (virtualNetworks() != null) { + virtualNetworks().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("virtualNetworks", this.virtualNetworks); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PropertiesNetworkInjection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PropertiesNetworkInjection 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 PropertiesNetworkInjection. + */ + public static PropertiesNetworkInjection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PropertiesNetworkInjection deserializedPropertiesNetworkInjection = new PropertiesNetworkInjection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("virtualNetworks".equals(fieldName)) { + deserializedPropertiesNetworkInjection.virtualNetworks + = VirtualNetworkPropertiesList.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPropertiesNetworkInjection; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/ResourceIdentityType.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/ResourceIdentityType.java new file mode 100644 index 000000000000..275917781869 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/ResourceIdentityType.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +/** + * The type of identity used for the EnterprisePolicy. Currently, the only supported type is 'SystemAssigned', which + * implicitly creates an identity. + */ +public enum ResourceIdentityType { + /** + * Enum value SystemAssigned. + */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** + * Enum value None. + */ + NONE("None"); + + /** + * The actual serialized value for a ResourceIdentityType instance. + */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + public static ResourceIdentityType fromString(String value) { + if (value == null) { + return null; + } + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/State.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/State.java new file mode 100644 index 000000000000..bda6a0a5fd1e --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/State.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The state of onboarding, which only appears in the response. + */ +public final class State extends ExpandableStringEnum { + /** + * Static value Enabled for State. + */ + public static final State ENABLED = fromString("Enabled"); + + /** + * Static value Disabled for State. + */ + public static final State DISABLED = fromString("Disabled"); + + /** + * Static value NotConfigured for State. + */ + public static final State NOT_CONFIGURED = fromString("NotConfigured"); + + /** + * Creates a new instance of State value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public State() { + } + + /** + * Creates or finds a State from its string representation. + * + * @param name a name to look for. + * @return the corresponding State. + */ + public static State fromString(String name) { + return fromString(name, State.class); + } + + /** + * Gets known State values. + * + * @return known State values. + */ + public static Collection values() { + return values(State.class); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/SubnetProperties.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/SubnetProperties.java new file mode 100644 index 000000000000..75037fbcd1a7 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/SubnetProperties.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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; + +/** + * Properties of a subnet. + */ +@Fluent +public final class SubnetProperties implements JsonSerializable { + /* + * Subnet name. + */ + private String name; + + /** + * Creates an instance of SubnetProperties class. + */ + public SubnetProperties() { + } + + /** + * Get the name property: Subnet name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Subnet name. + * + * @param name the name value to set. + * @return the SubnetProperties object itself. + */ + public SubnetProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubnetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubnetProperties 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 SubnetProperties. + */ + public static SubnetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubnetProperties deserializedSubnetProperties = new SubnetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSubnetProperties.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSubnetProperties; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/VirtualNetworkProperties.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/VirtualNetworkProperties.java new file mode 100644 index 000000000000..eac21029826a --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/VirtualNetworkProperties.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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; + +/** + * Settings concerning the virtual network. + */ +@Fluent +public final class VirtualNetworkProperties implements JsonSerializable { + /* + * Uri of the virtual network. + */ + private String id; + + /* + * Properties of a subnet. + */ + private SubnetProperties subnet; + + /** + * Creates an instance of VirtualNetworkProperties class. + */ + public VirtualNetworkProperties() { + } + + /** + * Get the id property: Uri of the virtual network. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Uri of the virtual network. + * + * @param id the id value to set. + * @return the VirtualNetworkProperties object itself. + */ + public VirtualNetworkProperties withId(String id) { + this.id = id; + return this; + } + + /** + * Get the subnet property: Properties of a subnet. + * + * @return the subnet value. + */ + public SubnetProperties subnet() { + return this.subnet; + } + + /** + * Set the subnet property: Properties of a subnet. + * + * @param subnet the subnet value to set. + * @return the VirtualNetworkProperties object itself. + */ + public VirtualNetworkProperties withSubnet(SubnetProperties subnet) { + this.subnet = subnet; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subnet() != null) { + subnet().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeJsonField("subnet", this.subnet); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualNetworkProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualNetworkProperties 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 VirtualNetworkProperties. + */ + public static VirtualNetworkProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualNetworkProperties deserializedVirtualNetworkProperties = new VirtualNetworkProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedVirtualNetworkProperties.id = reader.getString(); + } else if ("subnet".equals(fieldName)) { + deserializedVirtualNetworkProperties.subnet = SubnetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualNetworkProperties; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/VirtualNetworkPropertiesList.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/VirtualNetworkPropertiesList.java new file mode 100644 index 000000000000..254e9492980d --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/VirtualNetworkPropertiesList.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.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; + +/** + * A list of private link resources. + */ +@Fluent +public final class VirtualNetworkPropertiesList implements JsonSerializable { + /* + * Array of virtual networks. + */ + private List value; + + /* + * Next page link if any. + */ + private String nextLink; + + /** + * Creates an instance of VirtualNetworkPropertiesList class. + */ + public VirtualNetworkPropertiesList() { + } + + /** + * Get the value property: Array of virtual networks. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of virtual networks. + * + * @param value the value value to set. + * @return the VirtualNetworkPropertiesList object itself. + */ + public VirtualNetworkPropertiesList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Next page link if any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Next page link if any. + * + * @param nextLink the nextLink value to set. + * @return the VirtualNetworkPropertiesList object itself. + */ + public VirtualNetworkPropertiesList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@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 VirtualNetworkPropertiesList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualNetworkPropertiesList 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 VirtualNetworkPropertiesList. + */ + public static VirtualNetworkPropertiesList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualNetworkPropertiesList deserializedVirtualNetworkPropertiesList = new VirtualNetworkPropertiesList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> VirtualNetworkProperties.fromJson(reader1)); + deserializedVirtualNetworkPropertiesList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedVirtualNetworkPropertiesList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualNetworkPropertiesList; + }); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/package-info.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/package-info.java new file mode 100644 index 000000000000..0d39f13c2fc0 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for PowerPlatform. + * null. + */ +package com.azure.resourcemanager.powerplatform.models; diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/package-info.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/package-info.java new file mode 100644 index 000000000000..5aae743f5cc1 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/com/azure/resourcemanager/powerplatform/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for PowerPlatform. + * null. + */ +package com.azure.resourcemanager.powerplatform; diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/module-info.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/module-info.java new file mode 100644 index 000000000000..8f7333ab068c --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/java/module-info.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.powerplatform { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.powerplatform; + exports com.azure.resourcemanager.powerplatform.fluent; + exports com.azure.resourcemanager.powerplatform.fluent.models; + exports com.azure.resourcemanager.powerplatform.models; + + opens com.azure.resourcemanager.powerplatform.fluent.models to com.azure.core; + opens com.azure.resourcemanager.powerplatform.models to com.azure.core; +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-powerplatform/proxy-config.json b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-powerplatform/proxy-config.json new file mode 100644 index 000000000000..794e97b80f8a --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-powerplatform/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.powerplatform.implementation.AccountsClientImpl$AccountsService"],["com.azure.resourcemanager.powerplatform.implementation.EnterprisePoliciesClientImpl$EnterprisePoliciesService"],["com.azure.resourcemanager.powerplatform.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.powerplatform.implementation.PrivateEndpointConnectionsClientImpl$PrivateEndpointConnectionsService"],["com.azure.resourcemanager.powerplatform.implementation.PrivateLinkResourcesClientImpl$PrivateLinkResourcesService"]] \ No newline at end of file diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-powerplatform/reflect-config.json b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-powerplatform/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-powerplatform/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/resources/azure-resourcemanager-powerplatform.properties b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/resources/azure-resourcemanager-powerplatform.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/main/resources/azure-resourcemanager-powerplatform.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsCreateOrUpdateSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..0805c8519d8b --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsCreateOrUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Accounts CreateOrUpdate. + */ +public final class AccountsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * createOrUpdateAccount.json + */ + /** + * Sample code: Create or update account. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void createOrUpdateAccount(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.accounts() + .define("account") + .withRegion("East US") + .withExistingResourceGroup("resourceGroup") + .withTags(mapOf("Organization", "Administration")) + .withDescription("Description of the account.") + .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/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsDeleteSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsDeleteSamples.java new file mode 100644 index 000000000000..6026245e1850 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for Accounts Delete. + */ +public final class AccountsDeleteSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * deleteAccount.json + */ + /** + * Sample code: Delete account. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void deleteAccount(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.accounts() + .deleteByResourceGroupWithResponse("resourceGroup", "account", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsGetByResourceGroupSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..bff7e06857b4 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for Accounts GetByResourceGroup. + */ +public final class AccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * getAccount.json + */ + /** + * Sample code: Get account. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void getAccount(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.accounts().getByResourceGroupWithResponse("rg", "account", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsListByResourceGroupSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsListByResourceGroupSamples.java new file mode 100644 index 000000000000..ff394ff36e66 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsListByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for Accounts ListByResourceGroup. + */ +public final class AccountsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * listAccountsByResourceGroup.json + */ + /** + * Sample code: List accounts by resource group. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + listAccountsByResourceGroup(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.accounts().listByResourceGroup("rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsListSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsListSamples.java new file mode 100644 index 000000000000..ad6c86f68d85 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for Accounts List. + */ +public final class AccountsListSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * listAccountsBySubscription.json + */ + /** + * Sample code: List accounts by subscription. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + listAccountsBySubscription(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.accounts().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsUpdateSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsUpdateSamples.java new file mode 100644 index 000000000000..a82e69a8431d --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/AccountsUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +import com.azure.resourcemanager.powerplatform.models.Account; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Accounts Update. + */ +public final class AccountsUpdateSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * updateAccount.json + */ + /** + * Sample code: Update account. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void updateAccount(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + Account resource = manager.accounts() + .getByResourceGroupWithResponse("resourceGroup", "account", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("Organization", "Administration")) + .withDescription("Description of account.") + .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/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesCreateOrUpdateSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..92b47367109b --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesCreateOrUpdateSamples.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicyIdentity; +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicyKind; +import com.azure.resourcemanager.powerplatform.models.ResourceIdentityType; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnterprisePolicies CreateOrUpdate. + */ +public final class EnterprisePoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * createOrUpdateEnterprisePolicy.json + */ + /** + * Sample code: Create or update EnterprisePolicy. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + createOrUpdateEnterprisePolicy(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.enterprisePolicies() + .define("enterprisePolicy") + .withRegion("East US") + .withExistingResourceGroup("resourceGroup") + .withKind(EnterprisePolicyKind.LOCKBOX) + .withTags(mapOf("Organization", "Administration")) + .withIdentity(new EnterprisePolicyIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .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/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesDeleteSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesDeleteSamples.java new file mode 100644 index 000000000000..baaae87daa3b --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for EnterprisePolicies Delete. + */ +public final class EnterprisePoliciesDeleteSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * deleteEnterprisePolicy.json + */ + /** + * Sample code: Delete an EnterprisePolicy. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void deleteAnEnterprisePolicy(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.enterprisePolicies() + .deleteByResourceGroupWithResponse("resourceGroup", "enterprisePolicy", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesGetByResourceGroupSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..614ec293396e --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesGetByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for EnterprisePolicies GetByResourceGroup. + */ +public final class EnterprisePoliciesGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * getEnterprisePolicy.json + */ + /** + * Sample code: Get an EnterprisePolicy. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void getAnEnterprisePolicy(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.enterprisePolicies() + .getByResourceGroupWithResponse("rg", "enterprisePolicy", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesListByResourceGroupSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesListByResourceGroupSamples.java new file mode 100644 index 000000000000..072ab3be7a3c --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesListByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for EnterprisePolicies ListByResourceGroup. + */ +public final class EnterprisePoliciesListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * listEnterprisePoliciesByResourceGroup.json + */ + /** + * Sample code: List EnterprisePolicies by resource group. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + listEnterprisePoliciesByResourceGroup(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.enterprisePolicies().listByResourceGroup("rg1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesListSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesListSamples.java new file mode 100644 index 000000000000..e8aad92b1861 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for EnterprisePolicies List. + */ +public final class EnterprisePoliciesListSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * listEnterprisePoliciesBySubscription.json + */ + /** + * Sample code: List EnterprisePolicies by subscription. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + listEnterprisePoliciesBySubscription(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.enterprisePolicies().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesUpdateSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesUpdateSamples.java new file mode 100644 index 000000000000..2d9175bdbbdd --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/EnterprisePoliciesUpdateSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicy; +import com.azure.resourcemanager.powerplatform.models.EnterprisePolicyIdentity; +import com.azure.resourcemanager.powerplatform.models.ResourceIdentityType; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnterprisePolicies Update. + */ +public final class EnterprisePoliciesUpdateSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * updateEnterprisePolicy.json + */ + /** + * Sample code: Update EnterprisePolicy. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void updateEnterprisePolicy(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + EnterprisePolicy resource = manager.enterprisePolicies() + .getByResourceGroupWithResponse("resourceGroup", "enterprisePolicy", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("Organization", "Administration")) + .withIdentity(new EnterprisePolicyIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .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/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/OperationsListSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/OperationsListSamples.java new file mode 100644 index 000000000000..0dfdbcf8a9e6 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/OperationsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * listOperations.json + */ + /** + * Sample code: Lists all of the available PowerPlatform REST API operations. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void listsAllOfTheAvailablePowerPlatformRESTAPIOperations( + com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..6403c21c0b8e --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +import com.azure.resourcemanager.powerplatform.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.powerplatform.models.PrivateLinkServiceConnectionState; + +/** + * Samples for PrivateEndpointConnections CreateOrUpdate. + */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * PrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.privateEndpointConnections() + .define("privateEndpointConnectionName") + .withExistingEnterprisePolicy("rg1", "ddb1") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 000000000000..08ae090c08a0 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for PrivateEndpointConnections Delete. + */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.privateEndpointConnections() + .deleteWithResponse("rg1", "ddb1", "privateEndpointConnectionName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 000000000000..f77d8ce4f04b --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for PrivateEndpointConnections Get. + */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + getsPrivateEndpointConnection(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.privateEndpointConnections() + .getWithResponse("rg1", "ddb1", "privateEndpointConnectionName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateEndpointConnectionsListByEnterprisePolicySamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateEndpointConnectionsListByEnterprisePolicySamples.java new file mode 100644 index 000000000000..b95aaa58c512 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateEndpointConnectionsListByEnterprisePolicySamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for PrivateEndpointConnections ListByEnterprisePolicy. + */ +public final class PrivateEndpointConnectionsListByEnterprisePolicySamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * PrivateEndpointConnectionListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + getsPrivateEndpointConnection(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.privateEndpointConnections().listByEnterprisePolicy("rg1", "ddb1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateLinkResourcesGetSamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateLinkResourcesGetSamples.java new file mode 100644 index 000000000000..8cc0b9ad3954 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateLinkResourcesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for PrivateLinkResources Get. + */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * PrivateLinkResourceGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + getsPrivateEndpointConnection(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.privateLinkResources().getWithResponse("rg1", "ddb1", "sql", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateLinkResourcesListByEnterprisePolicySamples.java b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateLinkResourcesListByEnterprisePolicySamples.java new file mode 100644 index 000000000000..dcc91336bb88 --- /dev/null +++ b/sdk/powerplatform/azure-resourcemanager-powerplatform/src/samples/java/com/azure/resourcemanager/powerplatform/generated/PrivateLinkResourcesListByEnterprisePolicySamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerplatform.generated; + +/** + * Samples for PrivateLinkResources ListByEnterprisePolicy. + */ +public final class PrivateLinkResourcesListByEnterprisePolicySamples { + /* + * x-ms-original-file: + * specification/powerplatform/resource-manager/Microsoft.PowerPlatform/preview/2020-10-30-preview/examples/ + * PrivateLinkResourceListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to PowerPlatformManager. + */ + public static void + getsPrivateEndpointConnection(com.azure.resourcemanager.powerplatform.PowerPlatformManager manager) { + manager.privateLinkResources().listByEnterprisePolicy("rg1", "ddb1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/powerplatform/ci.yml b/sdk/powerplatform/ci.yml new file mode 100644 index 000000000000..8d2234d535bb --- /dev/null +++ b/sdk/powerplatform/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/powerplatform/ci.yml + - sdk/powerplatform/azure-resourcemanager-powerplatform/ + exclude: + - sdk/powerplatform/pom.xml + - sdk/powerplatform/azure-resourcemanager-powerplatform/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/powerplatform/ci.yml + - sdk/powerplatform/azure-resourcemanager-powerplatform/ + exclude: + - sdk/powerplatform/pom.xml + - sdk/powerplatform/azure-resourcemanager-powerplatform/pom.xml + +parameters: + - name: release_azureresourcemanagerpowerplatform + displayName: azure-resourcemanager-powerplatform + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: powerplatform + Artifacts: + - name: azure-resourcemanager-powerplatform + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerpowerplatform + releaseInBatch: ${{ parameters.release_azureresourcemanagerpowerplatform }} diff --git a/sdk/powerplatform/pom.xml b/sdk/powerplatform/pom.xml new file mode 100644 index 000000000000..1f6ab007364d --- /dev/null +++ b/sdk/powerplatform/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-powerplatform-service + pom + 1.0.0 + + + azure-resourcemanager-powerplatform + +