diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index e7ff0538aa28..312873507343 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -341,6 +341,7 @@ com.azure.resourcemanager:azure-resourcemanager-appcontainers;1.0.0-beta.2;1.0.0 com.azure.resourcemanager:azure-resourcemanager-scvmm;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-hardwaresecuritymodules;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-workloads;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-azureactivedirectory;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 1f6ce1b13a6f..b586222efc0b 100644 --- a/pom.xml +++ b/pom.xml @@ -852,6 +852,7 @@ sdk/automanage sdk/automation sdk/avs + sdk/azureactivedirectory sdk/azureadexternalidentities sdk/azurearcdata sdk/azurestack diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/CHANGELOG.md b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/CHANGELOG.md new file mode 100644 index 000000000000..1703360c17c4 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-05-20) + +- Azure Resource Manager Azureactivedirectory client library for Java. This package contains Microsoft Azure SDK for Azureactivedirectory Management SDK. Private link Policy for Azure Active Directory. Package tag package-2020-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/README.md b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/README.md new file mode 100644 index 000000000000..d2a05f7f5d20 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Azureactivedirectory client library for Java + +Azure Resource Manager Azureactivedirectory client library for Java. + +This package contains Microsoft Azure SDK for Azureactivedirectory Management SDK. Private link Policy for Azure Active Directory. Package tag package-2020-03. 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-azureactivedirectory;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-azureactivedirectory + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +AzureactivedirectoryManager manager = AzureactivedirectoryManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/SAMPLE.md b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/SAMPLE.md new file mode 100644 index 000000000000..a4150461a630 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/SAMPLE.md @@ -0,0 +1,360 @@ +# Code snippets and samples + + +## PrivateEndpointConnections + +- [Create](#privateendpointconnections_create) +- [Delete](#privateendpointconnections_delete) +- [Get](#privateendpointconnections_get) +- [ListByPolicyName](#privateendpointconnections_listbypolicyname) + +## PrivateLinkForAzureAd + +- [Create](#privatelinkforazuread_create) +- [Delete](#privatelinkforazuread_delete) +- [GetByResourceGroup](#privatelinkforazuread_getbyresourcegroup) +- [List](#privatelinkforazuread_list) +- [ListByResourceGroup](#privatelinkforazuread_listbyresourcegroup) +- [Update](#privatelinkforazuread_update) + +## PrivateLinkResources + +- [Get](#privatelinkresources_get) +- [ListByPrivateLinkPolicy](#privatelinkresources_listbyprivatelinkpolicy) +### PrivateEndpointConnections_Create + +```java +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpoint; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkServiceConnectionState; + +/** Samples for PrivateEndpointConnections Create. */ +public final class PrivateEndpointConnectionsCreateSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateEndpointConnectionsCreate.json + */ + /** + * Sample code: AadiamPutPrivateEndpointConnection. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void aadiamPutPrivateEndpointConnection( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager + .privateEndpointConnections() + .define("{privateEndpointConnection name}") + .withExistingPrivateLinkForAzureAd("resourcegroup", "example-policy-5849") + .withPrivateEndpoint( + new PrivateEndpoint() + .withId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/microsoft.aadiam/privateLinkForAzureAD/ddb1/privateLinkConnections/{privateEndpointConnection" + + " name}")) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("You may pass") + .withActionsRequired("None")) + .create(); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateEndpointConnectionsDelete.json + */ + /** + * Sample code: AadiamDeletePrivateEndpointConnections. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void aadiamDeletePrivateEndpointConnections( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager + .privateEndpointConnections() + .delete("myResourceGroup", "example-policy-5849", "{privateEndpointConnection name}", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateEndpointConnectionsGet.json + */ + /** + * Sample code: AadiamGetPrivateEndpointConnections. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void aadiamGetPrivateEndpointConnections( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager + .privateEndpointConnections() + .getWithResponse( + "myResourceGroup", "example-policy-5849", "{privateEndpointConnection name}", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByPolicyName + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByPolicyName. */ +public final class PrivateEndpointConnectionsListByPolicyNameSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateEndpointConnectionsList.json + */ + /** + * Sample code: AadiamListPrivateEndpointConnections. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void aadiamListPrivateEndpointConnections( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateEndpointConnections().listByPolicyName("myResourceGroup", "example-policy-5849", Context.NONE); + } +} +``` + +### PrivateLinkForAzureAd_Create + +```java +import java.util.Arrays; + +/** Samples for PrivateLinkForAzureAd Create. */ +public final class PrivateLinkForAzureAdCreateSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyCreate.json + */ + /** + * Sample code: privateLinkPolicyCreate. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyCreate( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager + .privateLinkForAzureAds() + .define("ddb1") + .withExistingResourceGroup("rg1") + .withName("myOrgPrivateLinkPolicy") + .withOwnerTenantId("950f8bca-bf4d-4a41-ad10-034e792a243d") + .withAllTenants(false) + .withTenants(Arrays.asList("3616657d-1c80-41ae-9d83-2a2776f2c9be", "727b6ef1-18ab-4627-ac95-3f9cd945ed87")) + .withResourceName("myOrgVnetPrivateLink") + .withSubscriptionId("57849194-ea1f-470b-abda-d195b25634c1") + .withResourceGroup("myOrgVnetRG") + .create(); + } + + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyMinCreate.json + */ + /** + * Sample code: privateLinkPolicyMinCreate. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyMinCreate( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager + .privateLinkForAzureAds() + .define("ddb1") + .withExistingResourceGroup("rg1") + .withName("myOrgPrivateLinkPolicy") + .withOwnerTenantId("950f8bca-bf4d-4a41-ad10-034e792a243d") + .withAllTenants(false) + .withTenants(Arrays.asList("3616657d-1c80-41ae-9d83-2a2776f2c9be", "727b6ef1-18ab-4627-ac95-3f9cd945ed87")) + .withResourceName("myOrgVnetPrivateLink") + .withSubscriptionId("57849194-ea1f-470b-abda-d195b25634c1") + .withResourceGroup("myOrgVnetRG") + .create(); + } +} +``` + +### PrivateLinkForAzureAd_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkForAzureAd Delete. */ +public final class PrivateLinkForAzureAdDeleteSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyDelete.json + */ + /** + * Sample code: privateLinkPolicyDelete. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyDelete( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateLinkForAzureAds().deleteWithResponse("rg1", "ddb1", Context.NONE); + } +} +``` + +### PrivateLinkForAzureAd_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkForAzureAd GetByResourceGroup. */ +public final class PrivateLinkForAzureAdGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyGet.json + */ + /** + * Sample code: privateLinkPolicyGet. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyGet( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateLinkForAzureAds().getByResourceGroupWithResponse("rg1", "ddb1", Context.NONE); + } +} +``` + +### PrivateLinkForAzureAd_List + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkForAzureAd List. */ +public final class PrivateLinkForAzureAdListSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyListBySubscription.json + */ + /** + * Sample code: privateLinkPolicyListBySubscription. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyListBySubscription( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateLinkForAzureAds().list(Context.NONE); + } +} +``` + +### PrivateLinkForAzureAd_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkForAzureAd ListByResourceGroup. */ +public final class PrivateLinkForAzureAdListByResourceGroupSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyList.json + */ + /** + * Sample code: privateLinkPolicyGetList. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyGetList( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateLinkForAzureAds().listByResourceGroup("rg1", Context.NONE); + } +} +``` + +### PrivateLinkForAzureAd_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkPolicy; +import java.util.HashMap; +import java.util.Map; + +/** Samples for PrivateLinkForAzureAd Update. */ +public final class PrivateLinkForAzureAdUpdateSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyUpdate.json + */ + /** + * Sample code: privateLinkPolicyUpdate. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyUpdate( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + PrivateLinkPolicy resource = + manager.privateLinkForAzureAds().getByResourceGroupWithResponse("rg1", "ddb1", Context.NONE).getValue(); + resource.update().withTags(mapOf()).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### PrivateLinkResources_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkResourceGet.json + */ + /** + * Sample code: Gets private endpoint connection by subscription id, resource group name, policy name, and group + * name. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void getsPrivateEndpointConnectionBySubscriptionIdResourceGroupNamePolicyNameAndGroupName( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateLinkResources().getWithResponse("rg1", "ddb1", "azureactivedirectory", Context.NONE); + } +} +``` + +### PrivateLinkResources_ListByPrivateLinkPolicy + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByPrivateLinkPolicy. */ +public final class PrivateLinkResourcesListByPrivateLinkPolicySamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkResourceListGet.json + */ + /** + * Sample code: Gets private endpoint connection by subscription id, resource group name, and policy name. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void getsPrivateEndpointConnectionBySubscriptionIdResourceGroupNameAndPolicyName( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateLinkResources().listByPrivateLinkPolicy("rg1", "ddb1", Context.NONE); + } +} +``` + diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/pom.xml b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/pom.xml new file mode 100644 index 000000000000..861d5b35dfa4 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-azureactivedirectory + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Azureactivedirectory Management + This package contains Microsoft Azure SDK for Azureactivedirectory Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Private link Policy for Azure Active Directory. Package tag package-2020-03. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.28.0 + + + com.azure + azure-core-management + 1.6.0 + + + diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/AzureactivedirectoryManager.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/AzureactivedirectoryManager.java new file mode 100644 index 000000000000..5e691242ec77 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/AzureactivedirectoryManager.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azureactivedirectory.fluent.Azureactivedirectory; +import com.azure.resourcemanager.azureactivedirectory.implementation.AzureactivedirectoryBuilder; +import com.azure.resourcemanager.azureactivedirectory.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.azureactivedirectory.implementation.PrivateLinkForAzureAdsImpl; +import com.azure.resourcemanager.azureactivedirectory.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpointConnections; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkForAzureAds; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkResources; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to AzureactivedirectoryManager. Private link Policy for Azure Active Directory. */ +public final class AzureactivedirectoryManager { + private PrivateLinkForAzureAds privateLinkForAzureAds; + + private PrivateLinkResources privateLinkResources; + + private PrivateEndpointConnections privateEndpointConnections; + + private final Azureactivedirectory clientObject; + + private AzureactivedirectoryManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new AzureactivedirectoryBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Azureactivedirectory service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Azureactivedirectory service API instance. + */ + public static AzureactivedirectoryManager 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 Azureactivedirectory service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Azureactivedirectory service API instance. + */ + public static AzureactivedirectoryManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new AzureactivedirectoryManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create AzureactivedirectoryManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new AzureactivedirectoryManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Azureactivedirectory service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Azureactivedirectory service API instance. + */ + public AzureactivedirectoryManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.azureactivedirectory") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new AzureactivedirectoryManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of PrivateLinkForAzureAds. It manages PrivateLinkPolicy. + * + * @return Resource collection API of PrivateLinkForAzureAds. + */ + public PrivateLinkForAzureAds privateLinkForAzureAds() { + if (this.privateLinkForAzureAds == null) { + this.privateLinkForAzureAds = + new PrivateLinkForAzureAdsImpl(clientObject.getPrivateLinkForAzureAds(), this); + } + return privateLinkForAzureAds; + } + + /** + * 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 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; + } + + /** + * @return Wrapped service client Azureactivedirectory providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public Azureactivedirectory serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/Azureactivedirectory.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/Azureactivedirectory.java new file mode 100644 index 000000000000..8d60f341074d --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/Azureactivedirectory.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for Azureactivedirectory class. */ +public interface Azureactivedirectory { + /** + * Gets Azure subscription ID. + * + * @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 PrivateLinkForAzureAdsClient object to access its operations. + * + * @return the PrivateLinkForAzureAdsClient object. + */ + PrivateLinkForAzureAdsClient getPrivateLinkForAzureAds(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/PrivateEndpointConnectionsClient.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 000000000000..f0df3ecae8ac --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateEndpointConnectionInner; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * Lists all Private Endpoint Connections for the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 link resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPolicyName(String resourceGroupName, String policyName); + + /** + * Lists all Private Endpoint Connections for the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 link resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPolicyName( + String resourceGroupName, String policyName, Context context); + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 the {@link SyncPoller} for polling of private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreate( + String resourceGroupName, + String policyName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 SyncPoller} for polling of private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreate( + String resourceGroupName, + String policyName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner create( + String resourceGroupName, + String policyName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner create( + String resourceGroupName, + String policyName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String policyName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String policyName, String privateEndpointConnectionName, Context context); + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String policyName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String policyName, String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the given policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get( + String resourceGroupName, String policyName, String privateEndpointConnectionName); + + /** + * Gets the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the given policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String policyName, String privateEndpointConnectionName, Context context); +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/PrivateLinkForAzureAdsClient.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/PrivateLinkForAzureAdsClient.java new file mode 100644 index 000000000000..3d24532e0ccf --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/PrivateLinkForAzureAdsClient.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.azureactivedirectory.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateLinkPolicyInner; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkPolicyUpdateParameter; + +/** An instance of this class provides access to all the operations defined in PrivateLinkForAzureAdsClient. */ +public interface PrivateLinkForAzureAdsClient { + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of privateLink Policy configuration object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateLinkPolicyInner> beginCreate( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy); + + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of privateLink Policy configuration object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateLinkPolicyInner> beginCreate( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy, Context context); + + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the 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 privateLink Policy configuration object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkPolicyInner create( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy); + + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the operation. + * @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 privateLink Policy configuration object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkPolicyInner create( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy, Context context); + + /** + * Updates private link policy tags with specified values. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return privateLink Policy configuration object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkPolicyInner update(String resourceGroupName, String policyName); + + /** + * Updates private link policy tags with specified values. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy Private Link Policy resource with the tags to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return privateLink Policy configuration object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String policyName, + PrivateLinkPolicyUpdateParameter privateLinkPolicy, + Context context); + + /** + * Gets a private link policy with a given name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 link policy with a given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkPolicyInner getByResourceGroup(String resourceGroupName, String policyName); + + /** + * Gets a private link policy with a given name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 link policy with a given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String policyName, Context context); + + /** + * Deletes a private link policy. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 policyName); + + /** + * Deletes a private link policy. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 policyName, Context context); + + /** + * Lists all Private Link Policies For AzureAD in the given 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 a list of private link policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all Private Link Policies For AzureAD in the given 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 link policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Operation to return the list of Private Link Policies For AzureAD scoped to the resourceGroup. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 link policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Operation to return the list of Private Link Policies For AzureAD scoped to the resourceGroup. + * + * @param resourceGroupName Name of an Azure resource group. + * @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 link policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/PrivateLinkResourcesClient.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 000000000000..e138416a43e4 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.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.azureactivedirectory.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 a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 a policy of AzureAD as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPrivateLinkPolicy(String resourceGroupName, String policyName); + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPrivateLinkPolicy( + String resourceGroupName, String policyName, Context context); + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(String resourceGroupName, String policyName, String groupName); + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String policyName, String groupName, Context context); +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateEndpointConnectionInner.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 000000000000..8e0fc14b4567 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateEndpointConnectionInner.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.azureactivedirectory.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpoint; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkServiceConnectionState; +import com.azure.resourcemanager.azureactivedirectory.models.TagsResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Private endpoint connection resource. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateEndpoint property: Properties of the private endpoint object. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Properties of the private endpoint object. + * + * @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: Approval state of the private link connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @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: Provisioning state of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the privateLinkConnectionTags property: Updated tag information to set into the PrivateLinkConnection + * instance. + * + * @return the privateLinkConnectionTags value. + */ + public TagsResource privateLinkConnectionTags() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkConnectionTags(); + } + + /** + * Set the privateLinkConnectionTags property: Updated tag information to set into the PrivateLinkConnection + * instance. + * + * @param privateLinkConnectionTags the privateLinkConnectionTags value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkConnectionTags(TagsResource privateLinkConnectionTags) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkConnectionTags(privateLinkConnectionTags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..e0f8628501bd --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpoint; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkServiceConnectionState; +import com.azure.resourcemanager.azureactivedirectory.models.TagsResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the private endpoint connection resource. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + /* + * Properties of the private endpoint object. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpoint privateEndpoint; + + /* + * Approval state of the private link connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * Provisioning state of the private endpoint connection. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointConnectionProvisioningState provisioningState; + + /* + * Updated tag information to set into the PrivateLinkConnection instance. + */ + @JsonProperty(value = "privateLinkConnectionTags") + private TagsResource privateLinkConnectionTags; + + /** + * Get the privateEndpoint property: Properties of the private endpoint object. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Properties of the private endpoint object. + * + * @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: Approval state of the private link connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @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: Provisioning state of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the privateLinkConnectionTags property: Updated tag information to set into the PrivateLinkConnection + * instance. + * + * @return the privateLinkConnectionTags value. + */ + public TagsResource privateLinkConnectionTags() { + return this.privateLinkConnectionTags; + } + + /** + * Set the privateLinkConnectionTags property: Updated tag information to set into the PrivateLinkConnection + * instance. + * + * @param privateLinkConnectionTags the privateLinkConnectionTags value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkConnectionTags(TagsResource privateLinkConnectionTags) { + this.privateLinkConnectionTags = privateLinkConnectionTags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + if (privateLinkConnectionTags() != null) { + privateLinkConnectionTags().validate(); + } + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateLinkPolicyInner.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateLinkPolicyInner.java new file mode 100644 index 000000000000..ae8e6426f0fa --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateLinkPolicyInner.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.azureactivedirectory.models.AzureResourceBase; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** PrivateLink Policy configuration object. */ +@Fluent +public final class PrivateLinkPolicyInner extends AzureResourceBase { + /* + * Guid of the owner tenant + */ + @JsonProperty(value = "ownerTenantId") + private String ownerTenantId; + + /* + * Flag indicating whether all tenants are allowed + */ + @JsonProperty(value = "allTenants") + private Boolean allTenants; + + /* + * The list of tenantIds. + */ + @JsonProperty(value = "tenants") + private List tenants; + + /* + * Name of the private link policy resource + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /* + * Subscription Identifier + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * Name of the resource group + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the ownerTenantId property: Guid of the owner tenant. + * + * @return the ownerTenantId value. + */ + public String ownerTenantId() { + return this.ownerTenantId; + } + + /** + * Set the ownerTenantId property: Guid of the owner tenant. + * + * @param ownerTenantId the ownerTenantId value to set. + * @return the PrivateLinkPolicyInner object itself. + */ + public PrivateLinkPolicyInner withOwnerTenantId(String ownerTenantId) { + this.ownerTenantId = ownerTenantId; + return this; + } + + /** + * Get the allTenants property: Flag indicating whether all tenants are allowed. + * + * @return the allTenants value. + */ + public Boolean allTenants() { + return this.allTenants; + } + + /** + * Set the allTenants property: Flag indicating whether all tenants are allowed. + * + * @param allTenants the allTenants value to set. + * @return the PrivateLinkPolicyInner object itself. + */ + public PrivateLinkPolicyInner withAllTenants(Boolean allTenants) { + this.allTenants = allTenants; + return this; + } + + /** + * Get the tenants property: The list of tenantIds. + * + * @return the tenants value. + */ + public List tenants() { + return this.tenants; + } + + /** + * Set the tenants property: The list of tenantIds. + * + * @param tenants the tenants value to set. + * @return the PrivateLinkPolicyInner object itself. + */ + public PrivateLinkPolicyInner withTenants(List tenants) { + this.tenants = tenants; + return this; + } + + /** + * Get the resourceName property: Name of the private link policy resource. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the resourceName property: Name of the private link policy resource. + * + * @param resourceName the resourceName value to set. + * @return the PrivateLinkPolicyInner object itself. + */ + public PrivateLinkPolicyInner withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * Get the subscriptionId property: Subscription Identifier. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Subscription Identifier. + * + * @param subscriptionId the subscriptionId value to set. + * @return the PrivateLinkPolicyInner object itself. + */ + public PrivateLinkPolicyInner withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroup property: Name of the resource group. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup property: Name of the resource group. + * + * @param resourceGroup the resourceGroup value to set. + * @return the PrivateLinkPolicyInner object itself. + */ + public PrivateLinkPolicyInner withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the PrivateLinkPolicyInner object itself. + */ + public PrivateLinkPolicyInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** {@inheritDoc} */ + @Override + public PrivateLinkPolicyInner withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateLinkResourceInner.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 000000000000..eb2c1239378d --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.azureactivedirectory.models.ArmProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A private link resource. */ +@Fluent +public final class PrivateLinkResourceInner extends ArmProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateLinkResourceProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateLinkResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateLinkResourceProperties.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateLinkResourceProperties.java new file mode 100644 index 000000000000..adab165dd8bc --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/PrivateLinkResourceProperties.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.azureactivedirectory.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a private link resource. */ +@Immutable +public final class PrivateLinkResourceProperties { + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/package-info.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/package-info.java new file mode 100644 index 000000000000..fd4febc57518 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/models/package-info.java @@ -0,0 +1,8 @@ +// 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 Azureactivedirectory. Private link Policy for Azure Active Directory. + */ +package com.azure.resourcemanager.azureactivedirectory.fluent.models; diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/package-info.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/package-info.java new file mode 100644 index 000000000000..c7e3db11b1d0 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for Azureactivedirectory. Private link Policy for Azure Active Directory. */ +package com.azure.resourcemanager.azureactivedirectory.fluent; diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/AzureactivedirectoryBuilder.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/AzureactivedirectoryBuilder.java new file mode 100644 index 000000000000..f4e6c6042203 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/AzureactivedirectoryBuilder.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.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 AzureactivedirectoryImpl type. */ +@ServiceClientBuilder(serviceClients = {AzureactivedirectoryImpl.class}) +public final class AzureactivedirectoryBuilder { + /* + * Azure subscription ID. + */ + private String subscriptionId; + + /** + * Sets Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the AzureactivedirectoryBuilder. + */ + public AzureactivedirectoryBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AzureactivedirectoryBuilder. + */ + public AzureactivedirectoryBuilder 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 AzureactivedirectoryBuilder. + */ + public AzureactivedirectoryBuilder 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 AzureactivedirectoryBuilder. + */ + public AzureactivedirectoryBuilder 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 AzureactivedirectoryBuilder. + */ + public AzureactivedirectoryBuilder 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 AzureactivedirectoryBuilder. + */ + public AzureactivedirectoryBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AzureactivedirectoryImpl with the provided parameters. + * + * @return an instance of AzureactivedirectoryImpl. + */ + public AzureactivedirectoryImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (pipeline == null) { + this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + AzureactivedirectoryImpl client = + new AzureactivedirectoryImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/AzureactivedirectoryImpl.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/AzureactivedirectoryImpl.java new file mode 100644 index 000000000000..4c785d986728 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/AzureactivedirectoryImpl.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.azureactivedirectory.fluent.Azureactivedirectory; +import com.azure.resourcemanager.azureactivedirectory.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.azureactivedirectory.fluent.PrivateLinkForAzureAdsClient; +import com.azure.resourcemanager.azureactivedirectory.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 AzureactivedirectoryImpl type. */ +@ServiceClient(builder = AzureactivedirectoryBuilder.class) +public final class AzureactivedirectoryImpl implements Azureactivedirectory { + /** Azure subscription ID. */ + private final String subscriptionId; + + /** + * Gets Azure subscription ID. + * + * @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 PrivateLinkForAzureAdsClient object to access its operations. */ + private final PrivateLinkForAzureAdsClient privateLinkForAzureAds; + + /** + * Gets the PrivateLinkForAzureAdsClient object to access its operations. + * + * @return the PrivateLinkForAzureAdsClient object. + */ + public PrivateLinkForAzureAdsClient getPrivateLinkForAzureAds() { + return this.privateLinkForAzureAds; + } + + /** 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; + } + + /** 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; + } + + /** + * Initializes an instance of Azureactivedirectory 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 Azure subscription ID. + * @param endpoint server parameter. + */ + AzureactivedirectoryImpl( + 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-03-01"; + this.privateLinkForAzureAds = new PrivateLinkForAzureAdsClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureactivedirectoryImpl.class); +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateEndpointConnectionImpl.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 000000000000..36d8a3e70925 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpoint; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpointConnection; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkServiceConnectionState; +import com.azure.resourcemanager.azureactivedirectory.models.TagsResource; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager serviceManager; + + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager 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 PrivateEndpoint privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public TagsResource privateLinkConnectionTags() { + return this.innerModel().privateLinkConnectionTags(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String policyName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingPrivateLinkForAzureAd( + String resourceGroupName, String policyName) { + this.resourceGroupName = resourceGroupName; + this.policyName = policyName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .create(resourceGroupName, policyName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .create(resourceGroupName, policyName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + String name, com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, policyName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, policyName, 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/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 000000000000..824671648867 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azureactivedirectory.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpointConnectionListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in 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 AzureactivedirectoryImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(AzureactivedirectoryImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureactivedirectoryPrivateEndpointConnections to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "Azureactivedirectory") + private interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.aadiam" + + "/privateLinkForAzureAd/{policyName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPolicyName( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("policyName") String policyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.aadiam" + + "/privateLinkForAzureAd/{policyName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("policyName") String policyName, + @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.aadiam" + + "/privateLinkForAzureAd/{policyName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("policyName") String policyName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.aadiam" + + "/privateLinkForAzureAd/{policyName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("policyName") String policyName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPolicyNameNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all Private Endpoint Connections for the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 link resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPolicyNameSinglePageAsync( + String resourceGroupName, String policyName) { + 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 + .listByPolicyName( + this.client.getEndpoint(), + resourceGroupName, + policyName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all Private Endpoint Connections for the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 link resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPolicyNameSinglePageAsync( + String resourceGroupName, String policyName, 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 + .listByPolicyName( + this.client.getEndpoint(), + resourceGroupName, + policyName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all Private Endpoint Connections for the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 link resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPolicyNameAsync( + String resourceGroupName, String policyName) { + return new PagedFlux<>( + () -> listByPolicyNameSinglePageAsync(resourceGroupName, policyName), + nextLink -> listByPolicyNameNextSinglePageAsync(nextLink)); + } + + /** + * Lists all Private Endpoint Connections for the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 link resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPolicyNameAsync( + String resourceGroupName, String policyName, Context context) { + return new PagedFlux<>( + () -> listByPolicyNameSinglePageAsync(resourceGroupName, policyName, context), + nextLink -> listByPolicyNameNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all Private Endpoint Connections for the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 link resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPolicyName(String resourceGroupName, String policyName) { + return new PagedIterable<>(listByPolicyNameAsync(resourceGroupName, policyName)); + } + + /** + * Lists all Private Endpoint Connections for the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 link resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPolicyName( + String resourceGroupName, String policyName, Context context) { + return new PagedIterable<>(listByPolicyNameAsync(resourceGroupName, policyName, context)); + } + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 private endpoint connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String policyName, + 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + policyName, + privateEndpointConnectionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 private endpoint connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String policyName, + 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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 + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + policyName, + privateEndpointConnectionName, + parameters, + accept, + context); + } + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 PollerFlux} for polling of private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> beginCreateAsync( + String resourceGroupName, + String policyName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, policyName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + this.client.getContext()); + } + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 PollerFlux} for polling of private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> beginCreateAsync( + String resourceGroupName, + String policyName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, policyName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 SyncPoller} for polling of private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreate( + String resourceGroupName, + String policyName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateAsync(resourceGroupName, policyName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 SyncPoller} for polling of private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreate( + String resourceGroupName, + String policyName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateAsync(resourceGroupName, policyName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 private endpoint connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String policyName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateAsync(resourceGroupName, policyName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 private endpoint connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String policyName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateAsync(resourceGroupName, policyName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner create( + String resourceGroupName, + String policyName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return createAsync(resourceGroupName, policyName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Creates specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param parameters The intended state of 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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner create( + String resourceGroupName, + String policyName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return createAsync(resourceGroupName, policyName, privateEndpointConnectionName, parameters, context).block(); + } + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String policyName, String privateEndpointConnectionName) { + 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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, + policyName, + privateEndpointConnectionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String policyName, 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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, + policyName, + privateEndpointConnectionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String policyName, String privateEndpointConnectionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, policyName, privateEndpointConnectionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String policyName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, policyName, privateEndpointConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String policyName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, policyName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String policyName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, policyName, privateEndpointConnectionName, context).getSyncPoller(); + } + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String policyName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, policyName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String policyName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, policyName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String policyName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, policyName, privateEndpointConnectionName).block(); + } + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String policyName, String privateEndpointConnectionName, Context context) { + deleteAsync(resourceGroupName, policyName, privateEndpointConnectionName, context).block(); + } + + /** + * Gets the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the given policy along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String policyName, String privateEndpointConnectionName) { + 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + policyName, + privateEndpointConnectionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the given policy along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String policyName, 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + policyName, + privateEndpointConnectionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the given policy on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String policyName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, policyName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the given policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get( + String resourceGroupName, String policyName, String privateEndpointConnectionName) { + return getAsync(resourceGroupName, policyName, privateEndpointConnectionName).block(); + } + + /** + * Gets the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the given policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String policyName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, policyName, privateEndpointConnectionName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPolicyNameNextSinglePageAsync(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.listByPolicyNameNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPolicyNameNextSinglePageAsync( + 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 + .listByPolicyNameNext(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/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateEndpointConnectionsImpl.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 000000000000..523882cbc314 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.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.azureactivedirectory.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpointConnection; +import com.azure.resourcemanager.azureactivedirectory.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.azureactivedirectory.AzureactivedirectoryManager serviceManager; + + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByPolicyName(String resourceGroupName, String policyName) { + PagedIterable inner = + this.serviceClient().listByPolicyName(resourceGroupName, policyName); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByPolicyName( + String resourceGroupName, String policyName, Context context) { + PagedIterable inner = + this.serviceClient().listByPolicyName(resourceGroupName, policyName, context); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public void delete(String resourceGroupName, String policyName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, policyName, privateEndpointConnectionName); + } + + public void delete( + String resourceGroupName, String policyName, String privateEndpointConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, policyName, privateEndpointConnectionName, context); + } + + public PrivateEndpointConnection get( + String resourceGroupName, String policyName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, policyName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String policyName, String privateEndpointConnectionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, policyName, 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 getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String policyName = Utils.getValueFromIdByName(id, "privateLinkForAzureAd"); + if (policyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkForAzureAd'.", + id))); + } + String privateEndpointConnectionName = Utils.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, policyName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String policyName = Utils.getValueFromIdByName(id, "privateLinkForAzureAd"); + if (policyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkForAzureAd'.", + id))); + } + String privateEndpointConnectionName = Utils.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, policyName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String policyName = Utils.getValueFromIdByName(id, "privateLinkForAzureAd"); + if (policyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkForAzureAd'.", + id))); + } + String privateEndpointConnectionName = Utils.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.delete(resourceGroupName, policyName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String policyName = Utils.getValueFromIdByName(id, "privateLinkForAzureAd"); + if (policyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkForAzureAd'.", + id))); + } + String privateEndpointConnectionName = Utils.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.delete(resourceGroupName, policyName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkForAzureAdsClientImpl.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkForAzureAdsClientImpl.java new file mode 100644 index 000000000000..723487cff053 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkForAzureAdsClientImpl.java @@ -0,0 +1,1369 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azureactivedirectory.fluent.PrivateLinkForAzureAdsClient; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateLinkPolicyInner; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkPolicyListResult; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkPolicyUpdateParameter; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkForAzureAdsClient. */ +public final class PrivateLinkForAzureAdsClientImpl implements PrivateLinkForAzureAdsClient { + /** The proxy service used to perform REST calls. */ + private final PrivateLinkForAzureAdsService service; + + /** The service client containing this operation class. */ + private final AzureactivedirectoryImpl client; + + /** + * Initializes an instance of PrivateLinkForAzureAdsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkForAzureAdsClientImpl(AzureactivedirectoryImpl client) { + this.service = + RestProxy + .create(PrivateLinkForAzureAdsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureactivedirectoryPrivateLinkForAzureAds to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "Azureactivedirectory") + private interface PrivateLinkForAzureAdsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.aadiam" + + "/privateLinkForAzureAd/{policyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("policyName") String policyName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PrivateLinkPolicyInner privateLinkPolicy, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.aadiam" + + "/privateLinkForAzureAd/{policyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("policyName") String policyName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PrivateLinkPolicyUpdateParameter privateLinkPolicy, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.aadiam" + + "/privateLinkForAzureAd/{policyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("policyName") String policyName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.aadiam" + + "/privateLinkForAzureAd/{policyName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("policyName") String policyName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/microsoft.aadiam/privateLinkForAzureAd") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.aadiam" + + "/privateLinkForAzureAd") + @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("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the 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 privateLink Policy configuration object along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy) { + 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (privateLinkPolicy == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkPolicy is required and cannot be null.")); + } else { + privateLinkPolicy.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + policyName, + this.client.getApiVersion(), + privateLinkPolicy, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the operation. + * @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 privateLink Policy configuration object along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy, 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (privateLinkPolicy == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkPolicy is required and cannot be null.")); + } else { + privateLinkPolicy.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + policyName, + this.client.getApiVersion(), + privateLinkPolicy, + accept, + context); + } + + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of privateLink Policy configuration object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateLinkPolicyInner> beginCreateAsync( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, policyName, privateLinkPolicy); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateLinkPolicyInner.class, + PrivateLinkPolicyInner.class, + this.client.getContext()); + } + + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of privateLink Policy configuration object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateLinkPolicyInner> beginCreateAsync( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, policyName, privateLinkPolicy, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateLinkPolicyInner.class, + PrivateLinkPolicyInner.class, + context); + } + + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of privateLink Policy configuration object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateLinkPolicyInner> beginCreate( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy) { + return beginCreateAsync(resourceGroupName, policyName, privateLinkPolicy).getSyncPoller(); + } + + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of privateLink Policy configuration object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateLinkPolicyInner> beginCreate( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy, Context context) { + return beginCreateAsync(resourceGroupName, policyName, privateLinkPolicy, context).getSyncPoller(); + } + + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the 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 privateLink Policy configuration object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy) { + return beginCreateAsync(resourceGroupName, policyName, privateLinkPolicy) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the operation. + * @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 privateLink Policy configuration object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy, Context context) { + return beginCreateAsync(resourceGroupName, policyName, privateLinkPolicy, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the 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 privateLink Policy configuration object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkPolicyInner create( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy) { + return createAsync(resourceGroupName, policyName, privateLinkPolicy).block(); + } + + /** + * Creates a private link policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy private link Policy supplied to the operation. + * @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 privateLink Policy configuration object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkPolicyInner create( + String resourceGroupName, String policyName, PrivateLinkPolicyInner privateLinkPolicy, Context context) { + return createAsync(resourceGroupName, policyName, privateLinkPolicy, context).block(); + } + + /** + * Updates private link policy tags with specified values. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy Private Link Policy resource with the tags to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return privateLink Policy configuration object along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String policyName, PrivateLinkPolicyUpdateParameter privateLinkPolicy) { + 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (privateLinkPolicy != null) { + privateLinkPolicy.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + policyName, + this.client.getApiVersion(), + privateLinkPolicy, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates private link policy tags with specified values. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy Private Link Policy resource with the tags to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return privateLink Policy configuration object along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String policyName, + PrivateLinkPolicyUpdateParameter privateLinkPolicy, + 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (privateLinkPolicy != null) { + privateLinkPolicy.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + policyName, + this.client.getApiVersion(), + privateLinkPolicy, + accept, + context); + } + + /** + * Updates private link policy tags with specified values. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy Private Link Policy resource with the tags to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return privateLink Policy configuration object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String policyName, PrivateLinkPolicyUpdateParameter privateLinkPolicy) { + return updateWithResponseAsync(resourceGroupName, policyName, privateLinkPolicy) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates private link policy tags with specified values. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return privateLink Policy configuration object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String policyName) { + final PrivateLinkPolicyUpdateParameter privateLinkPolicy = null; + return updateWithResponseAsync(resourceGroupName, policyName, privateLinkPolicy) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates private link policy tags with specified values. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return privateLink Policy configuration object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkPolicyInner update(String resourceGroupName, String policyName) { + final PrivateLinkPolicyUpdateParameter privateLinkPolicy = null; + return updateAsync(resourceGroupName, policyName, privateLinkPolicy).block(); + } + + /** + * Updates private link policy tags with specified values. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateLinkPolicy Private Link Policy resource with the tags to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return privateLink Policy configuration object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String policyName, + PrivateLinkPolicyUpdateParameter privateLinkPolicy, + Context context) { + return updateWithResponseAsync(resourceGroupName, policyName, privateLinkPolicy, context).block(); + } + + /** + * Gets a private link policy with a given name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 link policy with a given name along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String policyName) { + 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + policyName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private link policy with a given name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 link policy with a given name along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String policyName, 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + policyName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a private link policy with a given name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 link policy with a given name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String policyName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, policyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a private link policy with a given name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 link policy with a given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkPolicyInner getByResourceGroup(String resourceGroupName, String policyName) { + return getByResourceGroupAsync(resourceGroupName, policyName).block(); + } + + /** + * Gets a private link policy with a given name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 link policy with a given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String policyName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, policyName, context).block(); + } + + /** + * Deletes a private link policy. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 policyName) { + 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + policyName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a private link policy. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 policyName, 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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, + policyName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a private link policy. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 policyName) { + return deleteWithResponseAsync(resourceGroupName, policyName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a private link policy. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 policyName) { + deleteAsync(resourceGroupName, policyName).block(); + } + + /** + * Deletes a private link policy. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 policyName, Context context) { + return deleteWithResponseAsync(resourceGroupName, policyName, context).block(); + } + + /** + * Lists all Private Link Policies For AzureAD in the given 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 a list of private link policies 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())); + } + + /** + * Lists all Private Link Policies For AzureAD in the given 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 link policies 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)); + } + + /** + * Lists all Private Link Policies For AzureAD in the given 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 a list of private link policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all Private Link Policies For AzureAD in the given 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 link policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all Private Link Policies For AzureAD in the given 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 a list of private link policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all Private Link Policies For AzureAD in the given 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 link policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Operation to return the list of Private Link Policies For AzureAD scoped to the resourceGroup. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 link policies 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())); + } + + /** + * Operation to return the list of Private Link Policies For AzureAD scoped to the resourceGroup. + * + * @param resourceGroupName Name of an Azure resource group. + * @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 link policies 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)); + } + + /** + * Operation to return the list of Private Link Policies For AzureAD scoped to the resourceGroup. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 link policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Operation to return the list of Private Link Policies For AzureAD scoped to the resourceGroup. + * + * @param resourceGroupName Name of an Azure resource group. + * @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 link policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Operation to return the list of Private Link Policies For AzureAD scoped to the resourceGroup. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 link policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Operation to return the list of Private Link Policies For AzureAD scoped to the resourceGroup. + * + * @param resourceGroupName Name of an Azure resource group. + * @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 link policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link policies 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link policies along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link policies 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link policies 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/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkForAzureAdsImpl.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkForAzureAdsImpl.java new file mode 100644 index 000000000000..ed758feed332 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkForAzureAdsImpl.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.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.azureactivedirectory.fluent.PrivateLinkForAzureAdsClient; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateLinkPolicyInner; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkForAzureAds; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkPolicy; + +public final class PrivateLinkForAzureAdsImpl implements PrivateLinkForAzureAds { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkForAzureAdsImpl.class); + + private final PrivateLinkForAzureAdsClient innerClient; + + private final com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager serviceManager; + + public PrivateLinkForAzureAdsImpl( + PrivateLinkForAzureAdsClient innerClient, + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PrivateLinkPolicy getByResourceGroup(String resourceGroupName, String policyName) { + PrivateLinkPolicyInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, policyName); + if (inner != null) { + return new PrivateLinkPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String policyName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, policyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String policyName) { + this.serviceClient().delete(resourceGroupName, policyName); + } + + public Response deleteWithResponse(String resourceGroupName, String policyName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, policyName, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new PrivateLinkPolicyImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new PrivateLinkPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new PrivateLinkPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new PrivateLinkPolicyImpl(inner1, this.manager())); + } + + public PrivateLinkPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String policyName = Utils.getValueFromIdByName(id, "privateLinkForAzureAd"); + if (policyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkForAzureAd'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, policyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String policyName = Utils.getValueFromIdByName(id, "privateLinkForAzureAd"); + if (policyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkForAzureAd'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, policyName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String policyName = Utils.getValueFromIdByName(id, "privateLinkForAzureAd"); + if (policyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkForAzureAd'.", + id))); + } + this.deleteWithResponse(resourceGroupName, policyName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String policyName = Utils.getValueFromIdByName(id, "privateLinkForAzureAd"); + if (policyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkForAzureAd'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, policyName, context); + } + + private PrivateLinkForAzureAdsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager() { + return this.serviceManager; + } + + public PrivateLinkPolicyImpl define(String name) { + return new PrivateLinkPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkPolicyImpl.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkPolicyImpl.java new file mode 100644 index 000000000000..bce8fcbb3b54 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkPolicyImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateLinkPolicyInner; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkPolicy; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkPolicyUpdateParameter; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class PrivateLinkPolicyImpl + implements PrivateLinkPolicy, PrivateLinkPolicy.Definition, PrivateLinkPolicy.Update { + private PrivateLinkPolicyInner innerObject; + + private final com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public String ownerTenantId() { + return this.innerModel().ownerTenantId(); + } + + public Boolean allTenants() { + return this.innerModel().allTenants(); + } + + public List tenants() { + List inner = this.innerModel().tenants(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String resourceName() { + return this.innerModel().resourceName(); + } + + public String subscriptionId() { + return this.innerModel().subscriptionId(); + } + + public String resourceGroup() { + return this.innerModel().resourceGroup(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PrivateLinkPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String policyName; + + private PrivateLinkPolicyUpdateParameter updatePrivateLinkPolicy; + + public PrivateLinkPolicyImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public PrivateLinkPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkForAzureAds() + .create(resourceGroupName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateLinkPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkForAzureAds() + .create(resourceGroupName, policyName, this.innerModel(), context); + return this; + } + + PrivateLinkPolicyImpl( + String name, com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager serviceManager) { + this.innerObject = new PrivateLinkPolicyInner(); + this.serviceManager = serviceManager; + this.policyName = name; + } + + public PrivateLinkPolicyImpl update() { + this.updatePrivateLinkPolicy = new PrivateLinkPolicyUpdateParameter(); + return this; + } + + public PrivateLinkPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkForAzureAds() + .updateWithResponse(resourceGroupName, policyName, updatePrivateLinkPolicy, Context.NONE) + .getValue(); + return this; + } + + public PrivateLinkPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkForAzureAds() + .updateWithResponse(resourceGroupName, policyName, updatePrivateLinkPolicy, context) + .getValue(); + return this; + } + + PrivateLinkPolicyImpl( + PrivateLinkPolicyInner innerObject, + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.policyName = Utils.getValueFromIdByName(innerObject.id(), "privateLinkForAzureAd"); + } + + public PrivateLinkPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkForAzureAds() + .getByResourceGroupWithResponse(resourceGroupName, policyName, Context.NONE) + .getValue(); + return this; + } + + public PrivateLinkPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkForAzureAds() + .getByResourceGroupWithResponse(resourceGroupName, policyName, context) + .getValue(); + return this; + } + + public PrivateLinkPolicyImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updatePrivateLinkPolicy.withTags(tags); + return this; + } + } + + public PrivateLinkPolicyImpl withName(String name) { + this.innerModel().withName(name); + return this; + } + + public PrivateLinkPolicyImpl withOwnerTenantId(String ownerTenantId) { + this.innerModel().withOwnerTenantId(ownerTenantId); + return this; + } + + public PrivateLinkPolicyImpl withAllTenants(Boolean allTenants) { + this.innerModel().withAllTenants(allTenants); + return this; + } + + public PrivateLinkPolicyImpl withTenants(List tenants) { + this.innerModel().withTenants(tenants); + return this; + } + + public PrivateLinkPolicyImpl withResourceName(String resourceName) { + this.innerModel().withResourceName(resourceName); + return this; + } + + public PrivateLinkPolicyImpl withSubscriptionId(String subscriptionId) { + this.innerModel().withSubscriptionId(subscriptionId); + return this; + } + + public PrivateLinkPolicyImpl withResourceGroup(String resourceGroup) { + this.innerModel().withResourceGroup(resourceGroup); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkResourceImpl.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 000000000000..e1b1394ddb86 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkResourceImpl.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.azureactivedirectory.implementation; + +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkResource; +import java.util.Collections; +import java.util.List; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager serviceManager; + + PrivateLinkResourceImpl( + PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager 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 PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkResourcesClientImpl.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 000000000000..2a7dfe02ac0f --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,522 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.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.azureactivedirectory.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.azureactivedirectory.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 AzureactivedirectoryImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(AzureactivedirectoryImpl client) { + this.service = + RestProxy + .create(PrivateLinkResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureactivedirectoryPrivateLinkResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "Azureactivedirectory") + private interface PrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.aadiam" + + "/privateLinkForAzureAd/{policyName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPrivateLinkPolicy( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("policyName") String policyName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.aadiam" + + "/privateLinkForAzureAd/{policyName}/privateLinkResources/{groupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("policyName") String policyName, + @PathParam("groupName") String groupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPrivateLinkPolicyNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a policy of AzureAD along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPrivateLinkPolicySinglePageAsync( + String resourceGroupName, String policyName) { + 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByPrivateLinkPolicy( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + policyName, + 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())); + } + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPrivateLinkPolicySinglePageAsync( + String resourceGroupName, String policyName, 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByPrivateLinkPolicy( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + policyName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a policy of AzureAD as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPrivateLinkPolicyAsync( + String resourceGroupName, String policyName) { + return new PagedFlux<>( + () -> listByPrivateLinkPolicySinglePageAsync(resourceGroupName, policyName), + nextLink -> listByPrivateLinkPolicyNextSinglePageAsync(nextLink)); + } + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPrivateLinkPolicyAsync( + String resourceGroupName, String policyName, Context context) { + return new PagedFlux<>( + () -> listByPrivateLinkPolicySinglePageAsync(resourceGroupName, policyName, context), + nextLink -> listByPrivateLinkPolicyNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a policy of AzureAD as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPrivateLinkPolicy( + String resourceGroupName, String policyName) { + return new PagedIterable<>(listByPrivateLinkPolicyAsync(resourceGroupName, policyName)); + } + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPrivateLinkPolicy( + String resourceGroupName, String policyName, Context context) { + return new PagedIterable<>(listByPrivateLinkPolicyAsync(resourceGroupName, policyName, context)); + } + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String policyName, 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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, + policyName, + groupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String policyName, 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 (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName 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, + policyName, + groupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String policyName, String groupName) { + return getWithResponseAsync(resourceGroupName, policyName, groupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner get(String resourceGroupName, String policyName, String groupName) { + return getAsync(resourceGroupName, policyName, groupName).block(); + } + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String policyName, String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, policyName, groupName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPrivateLinkPolicyNextSinglePageAsync(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.listByPrivateLinkPolicyNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPrivateLinkPolicyNextSinglePageAsync( + 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 + .listByPrivateLinkPolicyNext(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/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkResourcesImpl.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 000000000000..40961b7c06e4 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.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.azureactivedirectory.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkResource; +import com.azure.resourcemanager.azureactivedirectory.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.azureactivedirectory.AzureactivedirectoryManager serviceManager; + + public PrivateLinkResourcesImpl( + PrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByPrivateLinkPolicy(String resourceGroupName, String policyName) { + PagedIterable inner = + this.serviceClient().listByPrivateLinkPolicy(resourceGroupName, policyName); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByPrivateLinkPolicy( + String resourceGroupName, String policyName, Context context) { + PagedIterable inner = + this.serviceClient().listByPrivateLinkPolicy(resourceGroupName, policyName, context); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PrivateLinkResource get(String resourceGroupName, String policyName, String groupName) { + PrivateLinkResourceInner inner = this.serviceClient().get(resourceGroupName, policyName, groupName); + if (inner != null) { + return new PrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String policyName, String groupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, policyName, groupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/Utils.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/Utils.java new file mode 100644 index 000000000000..7247a0b743ac --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/package-info.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/package-info.java new file mode 100644 index 000000000000..dcd759df533a --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for Azureactivedirectory. Private link Policy for Azure Active Directory. */ +package com.azure.resourcemanager.azureactivedirectory.implementation; diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/ArmProxyResource.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/ArmProxyResource.java new file mode 100644 index 000000000000..64578824fad9 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/ArmProxyResource.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; + +/** + * The resource model definition for a ARM proxy resource. It will have everything other than required location and + * tags. + */ +@Immutable +public class ArmProxyResource extends ProxyResource { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/AzureResourceBase.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/AzureResourceBase.java new file mode 100644 index 000000000000..b4d5f8efabf7 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/AzureResourceBase.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Common properties for all Azure resources. */ +@Fluent +public class AzureResourceBase extends ProxyResource { + /* + * Name of this resource. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: Name of this resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of this resource. + * + * @param name the name value to set. + * @return the AzureResourceBase object itself. + */ + public AzureResourceBase withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpoint.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpoint.java new file mode 100644 index 000000000000..250f60fa5833 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpoint.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.azureactivedirectory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Private endpoint object properties. */ +@Fluent +public final class PrivateEndpoint { + /* + * Full identifier of the private endpoint resource. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: Full identifier of the private endpoint resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Full identifier of the private endpoint resource. + * + * @param id the id value to set. + * @return the PrivateEndpoint object itself. + */ + public PrivateEndpoint withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointConnection.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointConnection.java new file mode 100644 index 000000000000..c3565666a1ef --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointConnection.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.azureactivedirectory.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 privateEndpoint property: Properties of the private endpoint object. + * + * @return the privateEndpoint value. + */ + PrivateEndpoint privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionState privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: Provisioning state of the private endpoint connection. + * + * @return the provisioningState value. + */ + PrivateEndpointConnectionProvisioningState provisioningState(); + + /** + * Gets the privateLinkConnectionTags property: Updated tag information to set into the PrivateLinkConnection + * instance. + * + * @return the privateLinkConnectionTags value. + */ + TagsResource privateLinkConnectionTags(); + + /** + * Gets the inner com.azure.resourcemanager.azureactivedirectory.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, policyName. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @return the next definition stage. + */ + WithCreate withExistingPrivateLinkForAzureAd(String resourceGroupName, String policyName); + } + /** + * 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: Properties of the private endpoint object.. + * + * @param privateEndpoint Properties of the private endpoint object. + * @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: Approval state of the private link connection.. + * + * @param privateLinkServiceConnectionState Approval state of the private link connection. + * @return the next definition stage. + */ + WithCreate 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/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointConnectionListResult.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 000000000000..e3b122f6f026 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Fluent +public final class PrivateEndpointConnectionListResult { + /* + * Array of private link resources + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to next page of results + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * 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 PrivateEndpointConnectionListResult object itself. + */ + public PrivateEndpointConnectionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to next page of results. + * + * @param nextLink the nextLink value to set. + * @return the PrivateEndpointConnectionListResult object itself. + */ + public PrivateEndpointConnectionListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointConnectionProvisioningState.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 000000000000..26187094d833 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateEndpointConnectionProvisioningState. */ +public final class PrivateEndpointConnectionProvisioningState + extends ExpandableStringEnum { + /** Static value Succeeded for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Provisioning for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState PROVISIONING = fromString("Provisioning"); + + /** Static value Failed for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState FAILED = fromString("Failed"); + + /** + * Creates or finds a PrivateEndpointConnectionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointConnectionProvisioningState. + */ + @JsonCreator + 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/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointConnections.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointConnections.java new file mode 100644 index 000000000000..3ad26af03c40 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointConnections.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.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 { + /** + * Lists all Private Endpoint Connections for the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 link resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByPolicyName(String resourceGroupName, String policyName); + + /** + * Lists all Private Endpoint Connections for the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 link resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByPolicyName( + String resourceGroupName, String policyName, Context context); + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String policyName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String policyName, String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the given policy. + */ + PrivateEndpointConnection get(String resourceGroupName, String policyName, String privateEndpointConnectionName); + + /** + * Gets the specified private endpoint connection associated with the given policy. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @param privateEndpointConnectionName The PrivateEndpointConnection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the given policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String policyName, String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the given policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the given policy along with {@link Response}. + */ + PrivateEndpointConnection getById(String id); + + /** + * Gets the specified private endpoint connection associated with the given policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the given policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified private endpoint connection associated with the given policy. + * + * @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 the specified private endpoint connection associated with the given policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new 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/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointServiceConnectionStatus.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointServiceConnectionStatus.java new file mode 100644 index 000000000000..a5393987f472 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateEndpointServiceConnectionStatus.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.azureactivedirectory.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateEndpointServiceConnectionStatus. */ +public final class PrivateEndpointServiceConnectionStatus + extends ExpandableStringEnum { + /** Static value Approved for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus APPROVED = fromString("Approved"); + + /** Static value Pending for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus PENDING = fromString("Pending"); + + /** Static value Rejected for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** Static value Disconnected for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus DISCONNECTED = fromString("Disconnected"); + + /** + * Creates or finds a PrivateEndpointServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointServiceConnectionStatus. + */ + @JsonCreator + 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/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkForAzureAds.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkForAzureAds.java new file mode 100644 index 000000000000..9095c6a0bc55 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkForAzureAds.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.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 PrivateLinkForAzureAds. */ +public interface PrivateLinkForAzureAds { + /** + * Gets a private link policy with a given name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 link policy with a given name. + */ + PrivateLinkPolicy getByResourceGroup(String resourceGroupName, String policyName); + + /** + * Gets a private link policy with a given name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 link policy with a given name along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String policyName, Context context); + + /** + * Deletes a private link policy. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 policyName); + + /** + * Deletes a private link policy. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 policyName, Context context); + + /** + * Lists all Private Link Policies For AzureAD in the given 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 a list of private link policies as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all Private Link Policies For AzureAD in the given 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 link policies as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Operation to return the list of Private Link Policies For AzureAD scoped to the resourceGroup. + * + * @param resourceGroupName Name of an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 link policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Operation to return the list of Private Link Policies For AzureAD scoped to the resourceGroup. + * + * @param resourceGroupName Name of an Azure resource group. + * @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 link policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a private link policy 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. + * @return a private link policy with a given name along with {@link Response}. + */ + PrivateLinkPolicy getById(String id); + + /** + * Gets a private link policy 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 a private link policy with a given name along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a private link policy. When operation completes, status code 200 returned without content. + * + * @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 link policy. When operation completes, status code 200 returned without content. + * + * @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 PrivateLinkPolicy resource. + * + * @param name resource name. + * @return the first stage of the new PrivateLinkPolicy definition. + */ + PrivateLinkPolicy.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkPolicy.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkPolicy.java new file mode 100644 index 000000000000..af1d839a878e --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkPolicy.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateLinkPolicyInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of PrivateLinkPolicy. */ +public interface PrivateLinkPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: Name of this resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the ownerTenantId property: Guid of the owner tenant. + * + * @return the ownerTenantId value. + */ + String ownerTenantId(); + + /** + * Gets the allTenants property: Flag indicating whether all tenants are allowed. + * + * @return the allTenants value. + */ + Boolean allTenants(); + + /** + * Gets the tenants property: The list of tenantIds. + * + * @return the tenants value. + */ + List tenants(); + + /** + * Gets the resourceName property: Name of the private link policy resource. + * + * @return the resourceName value. + */ + String resourceName(); + + /** + * Gets the subscriptionId property: Subscription Identifier. + * + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * Gets the resourceGroup property: Name of the resource group. + * + * @return the resourceGroup value. + */ + String resourceGroup(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateLinkPolicyInner object. + * + * @return the inner object. + */ + PrivateLinkPolicyInner innerModel(); + + /** The entirety of the PrivateLinkPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupStage, DefinitionStages.WithCreate { + } + /** The PrivateLinkPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateLinkPolicy definition. */ + interface Blank extends WithResourceGroupStage { + } + /** The stage of the PrivateLinkPolicy definition allowing to specify parent resource. */ + interface WithResourceGroupStage { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Name of an Azure resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the PrivateLinkPolicy 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.WithName, + DefinitionStages.WithOwnerTenantId, + DefinitionStages.WithAllTenants, + DefinitionStages.WithTenants, + DefinitionStages.WithResourceName, + DefinitionStages.WithSubscriptionId, + DefinitionStages.WithResourceGroup { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateLinkPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateLinkPolicy create(Context context); + } + /** The stage of the PrivateLinkPolicy 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 PrivateLinkPolicy definition allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: Name of this resource.. + * + * @param name Name of this resource. + * @return the next definition stage. + */ + WithCreate withName(String name); + } + /** The stage of the PrivateLinkPolicy definition allowing to specify ownerTenantId. */ + interface WithOwnerTenantId { + /** + * Specifies the ownerTenantId property: Guid of the owner tenant. + * + * @param ownerTenantId Guid of the owner tenant. + * @return the next definition stage. + */ + WithCreate withOwnerTenantId(String ownerTenantId); + } + /** The stage of the PrivateLinkPolicy definition allowing to specify allTenants. */ + interface WithAllTenants { + /** + * Specifies the allTenants property: Flag indicating whether all tenants are allowed. + * + * @param allTenants Flag indicating whether all tenants are allowed. + * @return the next definition stage. + */ + WithCreate withAllTenants(Boolean allTenants); + } + /** The stage of the PrivateLinkPolicy definition allowing to specify tenants. */ + interface WithTenants { + /** + * Specifies the tenants property: The list of tenantIds.. + * + * @param tenants The list of tenantIds. + * @return the next definition stage. + */ + WithCreate withTenants(List tenants); + } + /** The stage of the PrivateLinkPolicy definition allowing to specify resourceName. */ + interface WithResourceName { + /** + * Specifies the resourceName property: Name of the private link policy resource. + * + * @param resourceName Name of the private link policy resource. + * @return the next definition stage. + */ + WithCreate withResourceName(String resourceName); + } + /** The stage of the PrivateLinkPolicy definition allowing to specify subscriptionId. */ + interface WithSubscriptionId { + /** + * Specifies the subscriptionId property: Subscription Identifier. + * + * @param subscriptionId Subscription Identifier. + * @return the next definition stage. + */ + WithCreate withSubscriptionId(String subscriptionId); + } + /** The stage of the PrivateLinkPolicy definition allowing to specify resourceGroup. */ + interface WithResourceGroup { + /** + * Specifies the resourceGroup property: Name of the resource group. + * + * @param resourceGroup Name of the resource group. + * @return the next definition stage. + */ + WithCreate withResourceGroup(String resourceGroup); + } + } + /** + * Begins update for the PrivateLinkPolicy resource. + * + * @return the stage of resource update. + */ + PrivateLinkPolicy.Update update(); + + /** The template for PrivateLinkPolicy update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateLinkPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateLinkPolicy apply(Context context); + } + /** The PrivateLinkPolicy update stages. */ + interface UpdateStages { + /** The stage of the PrivateLinkPolicy update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags to be updated.. + * + * @param tags Resource tags to be updated. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateLinkPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateLinkPolicy refresh(Context context); +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkPolicyListResult.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkPolicyListResult.java new file mode 100644 index 000000000000..64f339b4385d --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkPolicyListResult.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateLinkPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link policies. */ +@Fluent +public final class PrivateLinkPolicyListResult { + /* + * Array of private link policies + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of operations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Array of private link policies. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private link policies. + * + * @param value the value value to set. + * @return the PrivateLinkPolicyListResult object itself. + */ + public PrivateLinkPolicyListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of operations. + * + * @param nextLink the nextLink value to set. + * @return the PrivateLinkPolicyListResult object itself. + */ + public PrivateLinkPolicyListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkPolicyUpdateParameter.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkPolicyUpdateParameter.java new file mode 100644 index 000000000000..be480352df05 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkPolicyUpdateParameter.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** private Link policy parameters to be updated. */ +@Fluent +public final class PrivateLinkPolicyUpdateParameter { + /* + * Resource tags to be updated. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Resource tags to be updated. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags to be updated. + * + * @param tags the tags value to set. + * @return the PrivateLinkPolicyUpdateParameter object itself. + */ + public PrivateLinkPolicyUpdateParameter withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkResource.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkResource.java new file mode 100644 index 000000000000..6189d503023c --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkResource.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.models; + +import com.azure.resourcemanager.azureactivedirectory.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 inner com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkResourceListResult.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkResourceListResult.java new file mode 100644 index 000000000000..9e335c360375 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkResourceListResult.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.azureactivedirectory.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Fluent +public final class PrivateLinkResourceListResult { + /* + * Array of private link resources + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of operations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * 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; + } + + /** + * Get the nextLink property: The link used to get the next page of operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of operations. + * + * @param nextLink the nextLink value to set. + * @return the PrivateLinkResourceListResult object itself. + */ + public PrivateLinkResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkResources.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkResources.java new file mode 100644 index 000000000000..b01d1334ca36 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkResources.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.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 a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 a policy of AzureAD as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByPrivateLinkPolicy(String resourceGroupName, String policyName); + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByPrivateLinkPolicy( + String resourceGroupName, String policyName, Context context); + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD. + */ + PrivateLinkResource get(String resourceGroupName, String policyName, String groupName); + + /** + * Gets the private link resources that need to be created for a policy of AzureAD. + * + * @param resourceGroupName Name of an Azure resource group. + * @param policyName The name of the private link policy in Azure AD. + * @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 a policy of AzureAD along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String policyName, String groupName, Context context); +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkServiceConnectionState.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 000000000000..397a94fb140c --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/PrivateLinkServiceConnectionState.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.azureactivedirectory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An object that represents the approval state of the private link connection. */ +@Fluent +public final class PrivateLinkServiceConnectionState { + /* + * Indicates whether the connection has been approved, rejected or removed + * by the given policy owner. + */ + @JsonProperty(value = "status") + private PrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval or rejection. + */ + @JsonProperty(value = "description") + private String description; + + /* + * A message indicating if changes on the service provider require any + * updates on the consumer. + */ + @JsonProperty(value = "actionsRequired") + private String actionsRequired; + + /** + * Get the status property: Indicates whether the connection has been approved, rejected or removed by the given + * policy owner. + * + * @return the status value. + */ + public PrivateEndpointServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates whether the connection has been approved, rejected or removed by the given + * policy owner. + * + * @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 or rejection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The reason for approval or rejection. + * + * @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() { + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/TagsResource.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/TagsResource.java new file mode 100644 index 000000000000..51ec3ef3e2f7 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/TagsResource.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * A container holding only the Tags for a resource, allowing the user to update the tags on a PrivateLinkConnection + * instance. + */ +@Fluent +public final class TagsResource { + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the TagsResource object itself. + */ + public TagsResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/package-info.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/package-info.java new file mode 100644 index 000000000000..7c483740c302 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for Azureactivedirectory. Private link Policy for Azure Active Directory. */ +package com.azure.resourcemanager.azureactivedirectory.models; diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/package-info.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/package-info.java new file mode 100644 index 000000000000..ca736617cc18 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/com/azure/resourcemanager/azureactivedirectory/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for Azureactivedirectory. Private link Policy for Azure Active Directory. */ +package com.azure.resourcemanager.azureactivedirectory; diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/module-info.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/module-info.java new file mode 100644 index 000000000000..1b61e3544dd6 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.azureactivedirectory { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.azureactivedirectory; + exports com.azure.resourcemanager.azureactivedirectory.fluent; + exports com.azure.resourcemanager.azureactivedirectory.fluent.models; + exports com.azure.resourcemanager.azureactivedirectory.models; + + opens com.azure.resourcemanager.azureactivedirectory.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.azureactivedirectory.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateEndpointConnectionsCreateSamples.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateEndpointConnectionsCreateSamples.java new file mode 100644 index 000000000000..680a6cff75c5 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateEndpointConnectionsCreateSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.generated; + +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpoint; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkServiceConnectionState; + +/** Samples for PrivateEndpointConnections Create. */ +public final class PrivateEndpointConnectionsCreateSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateEndpointConnectionsCreate.json + */ + /** + * Sample code: AadiamPutPrivateEndpointConnection. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void aadiamPutPrivateEndpointConnection( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager + .privateEndpointConnections() + .define("{privateEndpointConnection name}") + .withExistingPrivateLinkForAzureAd("resourcegroup", "example-policy-5849") + .withPrivateEndpoint( + new PrivateEndpoint() + .withId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/microsoft.aadiam/privateLinkForAzureAD/ddb1/privateLinkConnections/{privateEndpointConnection" + + " name}")) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("You may pass") + .withActionsRequired("None")) + .create(); + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 000000000000..ba471685ac7e --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateEndpointConnectionsDeleteSamples.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.azureactivedirectory.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateEndpointConnectionsDelete.json + */ + /** + * Sample code: AadiamDeletePrivateEndpointConnections. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void aadiamDeletePrivateEndpointConnections( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager + .privateEndpointConnections() + .delete("myResourceGroup", "example-policy-5849", "{privateEndpointConnection name}", Context.NONE); + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 000000000000..94a61a315c29 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/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.azureactivedirectory.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateEndpointConnectionsGet.json + */ + /** + * Sample code: AadiamGetPrivateEndpointConnections. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void aadiamGetPrivateEndpointConnections( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager + .privateEndpointConnections() + .getWithResponse( + "myResourceGroup", "example-policy-5849", "{privateEndpointConnection name}", Context.NONE); + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateEndpointConnectionsListByPolicyNameSamples.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateEndpointConnectionsListByPolicyNameSamples.java new file mode 100644 index 000000000000..11ee737dde6e --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateEndpointConnectionsListByPolicyNameSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByPolicyName. */ +public final class PrivateEndpointConnectionsListByPolicyNameSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateEndpointConnectionsList.json + */ + /** + * Sample code: AadiamListPrivateEndpointConnections. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void aadiamListPrivateEndpointConnections( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateEndpointConnections().listByPolicyName("myResourceGroup", "example-policy-5849", Context.NONE); + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdCreateSamples.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdCreateSamples.java new file mode 100644 index 000000000000..af019348c889 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdCreateSamples.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.azureactivedirectory.generated; + +import java.util.Arrays; + +/** Samples for PrivateLinkForAzureAd Create. */ +public final class PrivateLinkForAzureAdCreateSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyCreate.json + */ + /** + * Sample code: privateLinkPolicyCreate. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyCreate( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager + .privateLinkForAzureAds() + .define("ddb1") + .withExistingResourceGroup("rg1") + .withName("myOrgPrivateLinkPolicy") + .withOwnerTenantId("950f8bca-bf4d-4a41-ad10-034e792a243d") + .withAllTenants(false) + .withTenants(Arrays.asList("3616657d-1c80-41ae-9d83-2a2776f2c9be", "727b6ef1-18ab-4627-ac95-3f9cd945ed87")) + .withResourceName("myOrgVnetPrivateLink") + .withSubscriptionId("57849194-ea1f-470b-abda-d195b25634c1") + .withResourceGroup("myOrgVnetRG") + .create(); + } + + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyMinCreate.json + */ + /** + * Sample code: privateLinkPolicyMinCreate. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyMinCreate( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager + .privateLinkForAzureAds() + .define("ddb1") + .withExistingResourceGroup("rg1") + .withName("myOrgPrivateLinkPolicy") + .withOwnerTenantId("950f8bca-bf4d-4a41-ad10-034e792a243d") + .withAllTenants(false) + .withTenants(Arrays.asList("3616657d-1c80-41ae-9d83-2a2776f2c9be", "727b6ef1-18ab-4627-ac95-3f9cd945ed87")) + .withResourceName("myOrgVnetPrivateLink") + .withSubscriptionId("57849194-ea1f-470b-abda-d195b25634c1") + .withResourceGroup("myOrgVnetRG") + .create(); + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdDeleteSamples.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdDeleteSamples.java new file mode 100644 index 000000000000..9db9fe9cac54 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkForAzureAd Delete. */ +public final class PrivateLinkForAzureAdDeleteSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyDelete.json + */ + /** + * Sample code: privateLinkPolicyDelete. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyDelete( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateLinkForAzureAds().deleteWithResponse("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdGetByResourceGroupSamples.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdGetByResourceGroupSamples.java new file mode 100644 index 000000000000..e0a02309607f --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkForAzureAd GetByResourceGroup. */ +public final class PrivateLinkForAzureAdGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyGet.json + */ + /** + * Sample code: privateLinkPolicyGet. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyGet( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateLinkForAzureAds().getByResourceGroupWithResponse("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdListByResourceGroupSamples.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdListByResourceGroupSamples.java new file mode 100644 index 000000000000..262b4f25dac5 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkForAzureAd ListByResourceGroup. */ +public final class PrivateLinkForAzureAdListByResourceGroupSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyList.json + */ + /** + * Sample code: privateLinkPolicyGetList. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyGetList( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateLinkForAzureAds().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdListSamples.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdListSamples.java new file mode 100644 index 000000000000..710108cc498b --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkForAzureAd List. */ +public final class PrivateLinkForAzureAdListSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyListBySubscription.json + */ + /** + * Sample code: privateLinkPolicyListBySubscription. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyListBySubscription( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateLinkForAzureAds().list(Context.NONE); + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdUpdateSamples.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdUpdateSamples.java new file mode 100644 index 000000000000..817e8f2afa18 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkForAzureAdUpdateSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.azureactivedirectory.models.PrivateLinkPolicy; +import java.util.HashMap; +import java.util.Map; + +/** Samples for PrivateLinkForAzureAd Update. */ +public final class PrivateLinkForAzureAdUpdateSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkPolicyUpdate.json + */ + /** + * Sample code: privateLinkPolicyUpdate. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void privateLinkPolicyUpdate( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + PrivateLinkPolicy resource = + manager.privateLinkForAzureAds().getByResourceGroupWithResponse("rg1", "ddb1", Context.NONE).getValue(); + resource.update().withTags(mapOf()).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkResourcesGetSamples.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkResourcesGetSamples.java new file mode 100644 index 000000000000..2ad929a8a5c5 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkResourcesGetSamples.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.azureactivedirectory.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkResourceGet.json + */ + /** + * Sample code: Gets private endpoint connection by subscription id, resource group name, policy name, and group + * name. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void getsPrivateEndpointConnectionBySubscriptionIdResourceGroupNamePolicyNameAndGroupName( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateLinkResources().getWithResponse("rg1", "ddb1", "azureactivedirectory", Context.NONE); + } +} diff --git a/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkResourcesListByPrivateLinkPolicySamples.java b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkResourcesListByPrivateLinkPolicySamples.java new file mode 100644 index 000000000000..7ca36dddaa63 --- /dev/null +++ b/sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/src/samples/java/com/azure/resourcemanager/azureactivedirectory/generated/PrivateLinkResourcesListByPrivateLinkPolicySamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azureactivedirectory.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByPrivateLinkPolicy. */ +public final class PrivateLinkResourcesListByPrivateLinkPolicySamples { + /* + * x-ms-original-file: specification/azureactivedirectory/resource-manager/Microsoft.Aadiam/stable/2020-03-01/examples/AzureADPrivateLinkResourceListGet.json + */ + /** + * Sample code: Gets private endpoint connection by subscription id, resource group name, and policy name. + * + * @param manager Entry point to AzureactivedirectoryManager. + */ + public static void getsPrivateEndpointConnectionBySubscriptionIdResourceGroupNameAndPolicyName( + com.azure.resourcemanager.azureactivedirectory.AzureactivedirectoryManager manager) { + manager.privateLinkResources().listByPrivateLinkPolicy("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/azureactivedirectory/ci.yml b/sdk/azureactivedirectory/ci.yml new file mode 100644 index 000000000000..fbdbe6a5d644 --- /dev/null +++ b/sdk/azureactivedirectory/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/azureactivedirectory/ci.yml + - sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/ + exclude: + - sdk/azureactivedirectory/pom.xml + - sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azureactivedirectory/ci.yml + - sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/ + exclude: + - sdk/azureactivedirectory/pom.xml + - sdk/azureactivedirectory/azure-resourcemanager-azureactivedirectory/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: azureactivedirectory + Artifacts: + - name: azure-resourcemanager-azureactivedirectory + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerazureactivedirectory diff --git a/sdk/azureactivedirectory/pom.xml b/sdk/azureactivedirectory/pom.xml new file mode 100644 index 000000000000..b2b7df26d9bf --- /dev/null +++ b/sdk/azureactivedirectory/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-azureactivedirectory-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-azureactivedirectory + + + +