diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index fb5763f55f5ef..73a6db9808d07 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -337,6 +337,7 @@ com.azure.resourcemanager:azure-resourcemanager-securityinsights;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-oep;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-dnsresolver;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-mobilenetwork;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-managednetwork;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.1 diff --git a/pom.xml b/pom.xml index 0ce586ceb6e74..3aaf1f0cb8959 100644 --- a/pom.xml +++ b/pom.xml @@ -918,6 +918,7 @@ sdk/machinelearningservices sdk/maintenance sdk/managedapplications + sdk/managednetwork sdk/maps sdk/mariadb sdk/marketplaceordering diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/CHANGELOG.md b/sdk/managednetwork/azure-resourcemanager-managednetwork/CHANGELOG.md new file mode 100644 index 0000000000000..915ce2b315d19 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-03-02) + +- Azure Resource Manager ManagedNetwork client library for Java. This package contains Microsoft Azure SDK for ManagedNetwork Management SDK. The Microsoft Azure Managed Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to programmatically view, control, change, and monitor your entire Azure network centrally and with ease. Package tag package-2019-06-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/README.md b/sdk/managednetwork/azure-resourcemanager-managednetwork/README.md new file mode 100644 index 0000000000000..bcdde242f288d --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager ManagedNetwork client library for Java + +Azure Resource Manager ManagedNetwork client library for Java. + +This package contains Microsoft Azure SDK for ManagedNetwork Management SDK. The Microsoft Azure Managed Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to programmatically view, control, change, and monitor your entire Azure network centrally and with ease. Package tag package-2019-06-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-managednetwork;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-managednetwork + 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(); +ManagedNetworkManager manager = ManagedNetworkManager + .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/managednetwork/azure-resourcemanager-managednetwork/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/managednetwork/azure-resourcemanager-managednetwork/SAMPLE.md b/sdk/managednetwork/azure-resourcemanager-managednetwork/SAMPLE.md new file mode 100644 index 0000000000000..9ecfb1ab8fc3d --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/SAMPLE.md @@ -0,0 +1,554 @@ +# Code snippets and samples + + +## ManagedNetworkGroups + +- [CreateOrUpdate](#managednetworkgroups_createorupdate) +- [Delete](#managednetworkgroups_delete) +- [Get](#managednetworkgroups_get) +- [ListByManagedNetwork](#managednetworkgroups_listbymanagednetwork) + +## ManagedNetworkPeeringPolicies + +- [CreateOrUpdate](#managednetworkpeeringpolicies_createorupdate) +- [Delete](#managednetworkpeeringpolicies_delete) +- [Get](#managednetworkpeeringpolicies_get) +- [ListByManagedNetwork](#managednetworkpeeringpolicies_listbymanagednetwork) + +## ManagedNetworks + +- [CreateOrUpdate](#managednetworks_createorupdate) +- [Delete](#managednetworks_delete) +- [GetByResourceGroup](#managednetworks_getbyresourcegroup) +- [List](#managednetworks_list) +- [ListByResourceGroup](#managednetworks_listbyresourcegroup) +- [Update](#managednetworks_update) + +## ScopeAssignments + +- [CreateOrUpdate](#scopeassignments_createorupdate) +- [Delete](#scopeassignments_delete) +- [Get](#scopeassignments_get) +- [List](#scopeassignments_list) +### ManagedNetworkGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.managednetwork.models.ResourceId; +import java.util.Arrays; + +/** Samples for ManagedNetworkGroups CreateOrUpdate. */ +public final class ManagedNetworkGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkGroup/ManagedNetworkGroupsPut.json + */ + /** + * Sample code: ManagementNetworkGroupsPut. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managementNetworkGroupsPut( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkGroups() + .define("myManagedNetworkGroup1") + .withExistingManagedNetwork("myResourceGroup", "myManagedNetwork") + .withManagementGroups(Arrays.asList()) + .withSubscriptions(Arrays.asList()) + .withVirtualNetworks( + Arrays + .asList( + new ResourceId() + .withId( + "/subscriptionB/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetA"), + new ResourceId() + .withId( + "/subscriptionB/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetB"))) + .withSubnets( + Arrays + .asList( + new ResourceId() + .withId( + "/subscriptionB/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetA/subnets/subnetA"))) + .create(); + } +} +``` + +### ManagedNetworkGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedNetworkGroups Delete. */ +public final class ManagedNetworkGroupsDeleteSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkGroup/ManagedNetworkGroupsDelete.json + */ + /** + * Sample code: ManagementNetworkGroupsDelete. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managementNetworkGroupsDelete( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkGroups() + .delete("myResourceGroup", "myManagedNetwork", "myManagedNetworkGroup1", Context.NONE); + } +} +``` + +### ManagedNetworkGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedNetworkGroups Get. */ +public final class ManagedNetworkGroupsGetSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkGroup/ManagedNetworkGroupsGet.json + */ + /** + * Sample code: ManagementNetworkGroupsGet. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managementNetworkGroupsGet( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkGroups() + .getWithResponse("myResourceGroup", "myManagedNetwork", "myManagedNetworkGroup1", Context.NONE); + } +} +``` + +### ManagedNetworkGroups_ListByManagedNetwork + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedNetworkGroups ListByManagedNetwork. */ +public final class ManagedNetworkGroupsListByManagedNetworkSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkGroup/ManagedNetworkGroupsListByManagedNetwork.json + */ + /** + * Sample code: ManagedNetworksGroupsListByManagedNetwork. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksGroupsListByManagedNetwork( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkGroups() + .listByManagedNetwork("myResourceGroup", "myManagedNetwork", null, null, Context.NONE); + } +} +``` + +### ManagedNetworkPeeringPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkPeeringPolicyProperties; +import com.azure.resourcemanager.managednetwork.models.ResourceId; +import com.azure.resourcemanager.managednetwork.models.Type; +import java.util.Arrays; + +/** Samples for ManagedNetworkPeeringPolicies CreateOrUpdate. */ +public final class ManagedNetworkPeeringPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkPeeringPolicy/ManagedNetworkPeeringPoliciesPut.json + */ + /** + * Sample code: ManagedNetworkPeeringPoliciesPut. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworkPeeringPoliciesPut( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkPeeringPolicies() + .define("myHubAndSpoke") + .withExistingManagedNetwork("myResourceGroup", "myManagedNetwork") + .withProperties( + new ManagedNetworkPeeringPolicyProperties() + .withType(Type.HUB_AND_SPOKE_TOPOLOGY) + .withHub( + new ResourceId() + .withId( + "/subscriptionB/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myHubVnet")) + .withSpokes( + Arrays + .asList( + new ResourceId() + .withId( + "/subscriptionB/resourceGroups/myResourceGroup/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork/managedNetworkGroups/myManagedNetworkGroup1")))) + .create(); + } +} +``` + +### ManagedNetworkPeeringPolicies_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedNetworkPeeringPolicies Delete. */ +public final class ManagedNetworkPeeringPoliciesDeleteSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkPeeringPolicy/ManagedNetworkPeeringPoliciesDelete.json + */ + /** + * Sample code: ManagedNetworkPeeringPoliciesDelete. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworkPeeringPoliciesDelete( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkPeeringPolicies() + .delete("myResourceGroup", "myManagedNetwork", "myHubAndSpoke", Context.NONE); + } +} +``` + +### ManagedNetworkPeeringPolicies_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedNetworkPeeringPolicies Get. */ +public final class ManagedNetworkPeeringPoliciesGetSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkPeeringPolicy/ManagedNetworkPeeringPoliciesGet.json + */ + /** + * Sample code: ManagedNetworkPeeringPoliciesGet. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworkPeeringPoliciesGet( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkPeeringPolicies() + .getWithResponse("myResourceGroup", "myManagedNetwork", "myHubAndSpoke", Context.NONE); + } +} +``` + +### ManagedNetworkPeeringPolicies_ListByManagedNetwork + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedNetworkPeeringPolicies ListByManagedNetwork. */ +public final class ManagedNetworkPeeringPoliciesListByManagedNetworkSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkPeeringPolicy/ManagedNetworkPeeringPoliciesListByManagedNetwork.json + */ + /** + * Sample code: ManagedNetworkPeeringPoliciesListByManagedNetwork. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworkPeeringPoliciesListByManagedNetwork( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkPeeringPolicies() + .listByManagedNetwork("myResourceGroup", "myManagedNetwork", null, null, Context.NONE); + } +} +``` + +### ManagedNetworks_CreateOrUpdate + +```java +import com.azure.resourcemanager.managednetwork.models.ResourceId; +import com.azure.resourcemanager.managednetwork.models.Scope; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedNetworks CreateOrUpdate. */ +public final class ManagedNetworksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetwork/ManagedNetworksPut.json + */ + /** + * Sample code: ManagedNetworksPut. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksPut(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworks() + .define("myManagedNetwork") + .withRegion("eastus") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf()) + .withScope( + new Scope() + .withManagementGroups( + Arrays + .asList( + new ResourceId() + .withId( + "/providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000"), + new ResourceId() + .withId( + "/providers/Microsoft.Management/managementGroups/20000000-0002-0000-0000-000000000000"))) + .withSubscriptions( + Arrays + .asList(new ResourceId().withId("subscriptionA"), new ResourceId().withId("subscriptionB"))) + .withVirtualNetworks( + Arrays + .asList( + new ResourceId() + .withId( + "/subscriptions/subscriptionC/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetA"), + new ResourceId() + .withId( + "/subscriptions/subscriptionC/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetB"))) + .withSubnets( + Arrays + .asList( + new ResourceId() + .withId( + "/subscriptions/subscriptionC/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetC/subnets/subnetA"), + new ResourceId() + .withId( + "/subscriptions/subscriptionC/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetC/subnets/subnetB")))) + .create(); + } + + @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; + } +} +``` + +### ManagedNetworks_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedNetworks Delete. */ +public final class ManagedNetworksDeleteSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetwork/ManagedNetworksDelete.json + */ + /** + * Sample code: ManagedNetworksDelete. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksDelete(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager.managedNetworks().delete("myResourceGroup", "myManagedNetwork", Context.NONE); + } +} +``` + +### ManagedNetworks_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedNetworks GetByResourceGroup. */ +public final class ManagedNetworksGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetwork/ManagedNetworksGet.json + */ + /** + * Sample code: ManagedNetworksGet. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksGet(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager.managedNetworks().getByResourceGroupWithResponse("myResourceGroup", "myManagedNetwork", Context.NONE); + } +} +``` + +### ManagedNetworks_List + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedNetworks List. */ +public final class ManagedNetworksListSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetwork/ManagedNetworksListBySubscription.json + */ + /** + * Sample code: ManagedNetworksListBySubscription. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksListBySubscription( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager.managedNetworks().list(null, null, Context.NONE); + } +} +``` + +### ManagedNetworks_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedNetworks ListByResourceGroup. */ +public final class ManagedNetworksListByResourceGroupSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetwork/ManagedNetworksListByResourceGroup.json + */ + /** + * Sample code: ManagedNetworksListByResourceGroup. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksListByResourceGroup( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager.managedNetworks().listByResourceGroup("myResourceGroup", null, null, Context.NONE); + } +} +``` + +### ManagedNetworks_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.managednetwork.models.ManagedNetwork; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedNetworks Update. */ +public final class ManagedNetworksUpdateSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetwork/ManagedNetworksPatch.json + */ + /** + * Sample code: ManagedNetworksPatch. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksPatch(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + ManagedNetwork resource = + manager + .managedNetworks() + .getByResourceGroupWithResponse("myResourceGroup", "myManagedNetwork", 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; + } +} +``` + +### ScopeAssignments_CreateOrUpdate + +```java +/** Samples for ScopeAssignments CreateOrUpdate. */ +public final class ScopeAssignmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ScopeAssignment/ScopeAssignmentsPut.json + */ + /** + * Sample code: ScopeAssignmentsPut. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void scopeAssignmentsPut(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .scopeAssignments() + .define("subscriptionCAssignment") + .withExistingScope("subscriptions/subscriptionC") + .withAssignedManagedNetwork( + "/subscriptions/subscriptionA/resourceGroups/myResourceGroup/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork") + .create(); + } +} +``` + +### ScopeAssignments_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ScopeAssignments Delete. */ +public final class ScopeAssignmentsDeleteSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ScopeAssignment/ScopeAssignmentsDelete.json + */ + /** + * Sample code: ScopeAssignmentsDelete. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void scopeAssignmentsDelete(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .scopeAssignments() + .deleteWithResponse("subscriptions/subscriptionC", "subscriptionCAssignment", Context.NONE); + } +} +``` + +### ScopeAssignments_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ScopeAssignments Get. */ +public final class ScopeAssignmentsGetSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ScopeAssignment/ScopeAssignmentsGet.json + */ + /** + * Sample code: ScopeAssignmentsGet. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void scopeAssignmentsGet(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .scopeAssignments() + .getWithResponse("subscriptions/subscriptionC", "subscriptionCAssignment", Context.NONE); + } +} +``` + +### ScopeAssignments_List + +```java +import com.azure.core.util.Context; + +/** Samples for ScopeAssignments List. */ +public final class ScopeAssignmentsListSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ScopeAssignment/ScopeAssignmentsList.json + */ + /** + * Sample code: ScopeAssignmentsList. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void scopeAssignmentsList(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager.scopeAssignments().list("subscriptions/subscriptionC", Context.NONE); + } +} +``` + diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/pom.xml b/sdk/managednetwork/azure-resourcemanager-managednetwork/pom.xml new file mode 100644 index 0000000000000..5233dca65c455 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/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-managednetwork + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for ManagedNetwork Management + This package contains Microsoft Azure SDK for ManagedNetwork Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Microsoft Azure Managed Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to programmatically view, control, change, and monitor your entire Azure network centrally and with ease. Package tag package-2019-06-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.25.0 + + + com.azure + azure-core-management + 1.5.2 + + + diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/ManagedNetworkManager.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/ManagedNetworkManager.java new file mode 100644 index 0000000000000..d3e9e86d592d7 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/ManagedNetworkManager.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork; + +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.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.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.managednetwork.fluent.ManagedNetworkManagementClient; +import com.azure.resourcemanager.managednetwork.implementation.ManagedNetworkGroupsImpl; +import com.azure.resourcemanager.managednetwork.implementation.ManagedNetworkManagementClientBuilder; +import com.azure.resourcemanager.managednetwork.implementation.ManagedNetworkPeeringPoliciesImpl; +import com.azure.resourcemanager.managednetwork.implementation.ManagedNetworksImpl; +import com.azure.resourcemanager.managednetwork.implementation.OperationsImpl; +import com.azure.resourcemanager.managednetwork.implementation.ScopeAssignmentsImpl; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkGroups; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkPeeringPolicies; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworks; +import com.azure.resourcemanager.managednetwork.models.Operations; +import com.azure.resourcemanager.managednetwork.models.ScopeAssignments; +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 ManagedNetworkManager. The Microsoft Azure Managed Network management API provides a RESTful set of + * web services that interact with Microsoft Azure Networks service to programmatically view, control, change, and + * monitor your entire Azure network centrally and with ease. + */ +public final class ManagedNetworkManager { + private ManagedNetworks managedNetworks; + + private ScopeAssignments scopeAssignments; + + private ManagedNetworkGroups managedNetworkGroups; + + private ManagedNetworkPeeringPolicies managedNetworkPeeringPolicies; + + private Operations operations; + + private final ManagedNetworkManagementClient clientObject; + + private ManagedNetworkManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ManagedNetworkManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ManagedNetwork service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ManagedNetwork service API instance. + */ + public static ManagedNetworkManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create ManagedNetworkManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ManagedNetworkManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private 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 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 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, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of ManagedNetwork service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ManagedNetwork service API instance. + */ + public ManagedNetworkManager 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.managednetwork") + .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) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + 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 ManagedNetworkManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of ManagedNetworks. */ + public ManagedNetworks managedNetworks() { + if (this.managedNetworks == null) { + this.managedNetworks = new ManagedNetworksImpl(clientObject.getManagedNetworks(), this); + } + return managedNetworks; + } + + /** @return Resource collection API of ScopeAssignments. */ + public ScopeAssignments scopeAssignments() { + if (this.scopeAssignments == null) { + this.scopeAssignments = new ScopeAssignmentsImpl(clientObject.getScopeAssignments(), this); + } + return scopeAssignments; + } + + /** @return Resource collection API of ManagedNetworkGroups. */ + public ManagedNetworkGroups managedNetworkGroups() { + if (this.managedNetworkGroups == null) { + this.managedNetworkGroups = new ManagedNetworkGroupsImpl(clientObject.getManagedNetworkGroups(), this); + } + return managedNetworkGroups; + } + + /** @return Resource collection API of ManagedNetworkPeeringPolicies. */ + public ManagedNetworkPeeringPolicies managedNetworkPeeringPolicies() { + if (this.managedNetworkPeeringPolicies == null) { + this.managedNetworkPeeringPolicies = + new ManagedNetworkPeeringPoliciesImpl(clientObject.getManagedNetworkPeeringPolicies(), this); + } + return managedNetworkPeeringPolicies; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * @return Wrapped service client ManagedNetworkManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public ManagedNetworkManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkGroupsClient.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkGroupsClient.java new file mode 100644 index 0000000000000..ba05499c6ebb3 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkGroupsClient.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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.managednetwork.fluent.models.ManagedNetworkGroupInner; + +/** An instance of this class provides access to all the operations defined in ManagedNetworkGroupsClient. */ +public interface ManagedNetworkGroupsClient { + /** + * The Get ManagedNetworkGroups operation gets a Managed Network Group specified by the resource group, Managed + * Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the Managed Network Group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedNetworkGroupInner get(String resourceGroupName, String managedNetworkName, String managedNetworkGroupName); + + /** + * The Get ManagedNetworkGroups operation gets a Managed Network Group specified by the resource group, Managed + * Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the Managed Network Group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, Context context); + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Managed Network Group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedNetworkGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup); + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Managed Network Group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedNetworkGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup, + Context context); + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group 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 Managed Network Group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedNetworkGroupInner createOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup); + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group 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 Managed Network Group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedNetworkGroupInner createOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup, + Context context); + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName); + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, Context context); + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedNetworkName, String managedNetworkGroupName); + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, Context context); + + /** + * The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the Managed Network Groups in a specified + * Managed Networks in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedNetwork(String resourceGroupName, String managedNetworkName); + + /** + * The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the Managed Network Groups in a specified + * Managed Networks in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 result of the request to list Managed Network Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken, Context context); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkManagementClient.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkManagementClient.java new file mode 100644 index 0000000000000..749a6e9f26df6 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkManagementClient.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ManagedNetworkManagementClient class. */ +public interface ManagedNetworkManagementClient { + /** + * Gets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID + * forms part of the URI for every service call. + * + * @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 ManagedNetworksClient object to access its operations. + * + * @return the ManagedNetworksClient object. + */ + ManagedNetworksClient getManagedNetworks(); + + /** + * Gets the ScopeAssignmentsClient object to access its operations. + * + * @return the ScopeAssignmentsClient object. + */ + ScopeAssignmentsClient getScopeAssignments(); + + /** + * Gets the ManagedNetworkGroupsClient object to access its operations. + * + * @return the ManagedNetworkGroupsClient object. + */ + ManagedNetworkGroupsClient getManagedNetworkGroups(); + + /** + * Gets the ManagedNetworkPeeringPoliciesClient object to access its operations. + * + * @return the ManagedNetworkPeeringPoliciesClient object. + */ + ManagedNetworkPeeringPoliciesClient getManagedNetworkPeeringPolicies(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkPeeringPoliciesClient.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkPeeringPoliciesClient.java new file mode 100644 index 0000000000000..a309deb4d386e --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkPeeringPoliciesClient.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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.managednetwork.fluent.models.ManagedNetworkPeeringPolicyInner; + +/** An instance of this class provides access to all the operations defined in ManagedNetworkPeeringPoliciesClient. */ +public interface ManagedNetworkPeeringPoliciesClient { + /** + * The Get ManagedNetworkPeeringPolicies operation gets a Managed Network Peering Policy resource, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedNetworkPeeringPolicyInner get( + String resourceGroupName, String managedNetworkName, String managedNetworkPeeringPolicyName); + + /** + * The Get ManagedNetworkPeeringPolicies operation gets a Managed Network Peering Policy resource, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @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 Managed Network Peering Policy resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedNetworkName, String managedNetworkPeeringPolicyName, Context context); + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 the Managed Network Peering Policy resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedNetworkPeeringPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy); + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @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 the Managed Network Peering Policy resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedNetworkPeeringPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy, + Context context); + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedNetworkPeeringPolicyInner createOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy); + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @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 Managed Network Peering Policy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedNetworkPeeringPolicyInner createOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy, + Context context); + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 managedNetworkName, String managedNetworkPeeringPolicyName); + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @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 managedNetworkName, String managedNetworkPeeringPolicyName, Context context); + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 managedNetworkName, String managedNetworkPeeringPolicyName); + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @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 managedNetworkName, String managedNetworkPeeringPolicyName, Context context); + + /** + * The ListByManagedNetwork PeeringPolicies operation retrieves all the Managed Network Peering Policies in a + * specified Managed Network, in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Peering Policies as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName); + + /** + * The ListByManagedNetwork PeeringPolicies operation retrieves all the Managed Network Peering Policies in a + * specified Managed Network, in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 result of the request to list Managed Network Peering Policies as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken, Context context); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworksClient.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworksClient.java new file mode 100644 index 0000000000000..3b4bc026a0b50 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworksClient.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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.managednetwork.fluent.models.ManagedNetworkInner; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkUpdate; + +/** An instance of this class provides access to all the operations defined in ManagedNetworksClient. */ +public interface ManagedNetworksClient { + /** + * The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed + * Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedNetworkInner getByResourceGroup(String resourceGroupName, String managedNetworkName); + + /** + * The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed + * Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @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 Managed Network resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String managedNetworkName, Context context); + + /** + * The Put ManagedNetworks operation creates/updates a Managed Network Resource, specified by resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetwork Parameters supplied to the create/update a Managed Network 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 Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedNetworkInner createOrUpdate( + String resourceGroupName, String managedNetworkName, ManagedNetworkInner managedNetwork); + + /** + * The Put ManagedNetworks operation creates/updates a Managed Network Resource, specified by resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetwork Parameters supplied to the create/update a Managed Network 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 Managed Network resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String managedNetworkName, ManagedNetworkInner managedNetwork, Context context); + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 managedNetworkName); + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @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 managedNetworkName, Context context); + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 managedNetworkName); + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @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 managedNetworkName, Context context); + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 the Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedNetworkInner> beginUpdate( + String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate parameters); + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @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 the Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedNetworkInner> beginUpdate( + String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate parameters, Context context); + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedNetworkInner update(String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate parameters); + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @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 Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedNetworkInner update( + String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate parameters, Context context); + + /** + * The ListByResourceGroup ManagedNetwork operation retrieves all the Managed Network resources in a resource group + * in a paginated format. + * + * @param resourceGroupName The name of the 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 result of the request to list Managed Network as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * The ListByResourceGroup ManagedNetwork operation retrieves all the Managed Network resources in a resource group + * in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 result of the request to list Managed Network as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, String skiptoken, Context context); + + /** + * The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current + * subscription in a paginated format. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current + * subscription in a paginated format. + * + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 result of the request to list Managed Network as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Integer top, String skiptoken, Context context); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/OperationsClient.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/OperationsClient.java new file mode 100644 index 0000000000000..6c16fc34f57cb --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/OperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managednetwork.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available MNC operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available MNC operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ScopeAssignmentsClient.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ScopeAssignmentsClient.java new file mode 100644 index 0000000000000..4356b7993535e --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ScopeAssignmentsClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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.managednetwork.fluent.models.ScopeAssignmentInner; + +/** An instance of this class provides access to all the operations defined in ScopeAssignmentsClient. */ +public interface ScopeAssignmentsClient { + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @param scopeAssignmentName The name of the scope assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 scope assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScopeAssignmentInner get(String scope, String scopeAssignmentName); + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @param scopeAssignmentName The name of the scope assignment to get. + * @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 scope assignment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String scopeAssignmentName, Context context); + + /** + * Creates a scope assignment. + * + * @param scope The base resource of the scope assignment to create. The scope can be any REST resource instance. + * For example, use 'subscriptions/{subscription-id}' for a subscription, + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param scopeAssignmentName The name of the scope assignment to create. + * @param parameters Parameters supplied to the specify which Managed Network this scope is being assigned. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScopeAssignmentInner createOrUpdate(String scope, String scopeAssignmentName, ScopeAssignmentInner parameters); + + /** + * Creates a scope assignment. + * + * @param scope The base resource of the scope assignment to create. The scope can be any REST resource instance. + * For example, use 'subscriptions/{subscription-id}' for a subscription, + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param scopeAssignmentName The name of the scope assignment to create. + * @param parameters Parameters supplied to the specify which Managed Network this scope is being assigned. + * @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 Managed Network resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String scope, String scopeAssignmentName, ScopeAssignmentInner parameters, Context context); + + /** + * Deletes a scope assignment. + * + * @param scope The scope of the scope assignment to delete. + * @param scopeAssignmentName The name of the scope assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 scope, String scopeAssignmentName); + + /** + * Deletes a scope assignment. + * + * @param scope The scope of the scope assignment to delete. + * @param scopeAssignmentName The name of the scope assignment to delete. + * @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 scope, String scopeAssignmentName, Context context); + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 scope assignment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @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 scope assignment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, Context context); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkGroupInner.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkGroupInner.java new file mode 100644 index 0000000000000..d9e0925ecee61 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkGroupInner.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.models.Kind; +import com.azure.resourcemanager.managednetwork.models.ProvisioningState; +import com.azure.resourcemanager.managednetwork.models.ResourceId; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The Managed Network Group resource. */ +@Fluent +public final class ManagedNetworkGroupInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedNetworkGroupInner.class); + + /* + * Gets or sets the properties of a network group + */ + @JsonProperty(value = "properties") + private ManagedNetworkGroupProperties innerProperties; + + /* + * Responsibility role under which this Managed Network Group will be + * created + */ + @JsonProperty(value = "kind") + private Kind kind; + + /** + * Get the innerProperties property: Gets or sets the properties of a network group. + * + * @return the innerProperties value. + */ + private ManagedNetworkGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the kind property: Responsibility role under which this Managed Network Group will be created. + * + * @return the kind value. + */ + public Kind kind() { + return this.kind; + } + + /** + * Set the kind property: Responsibility role under which this Managed Network Group will be created. + * + * @param kind the kind value to set. + * @return the ManagedNetworkGroupInner object itself. + */ + public ManagedNetworkGroupInner withKind(Kind kind) { + this.kind = kind; + return this; + } + + /** + * Get the managementGroups property: The collection of management groups covered by the Managed Network. + * + * @return the managementGroups value. + */ + public List managementGroups() { + return this.innerProperties() == null ? null : this.innerProperties().managementGroups(); + } + + /** + * Set the managementGroups property: The collection of management groups covered by the Managed Network. + * + * @param managementGroups the managementGroups value to set. + * @return the ManagedNetworkGroupInner object itself. + */ + public ManagedNetworkGroupInner withManagementGroups(List managementGroups) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedNetworkGroupProperties(); + } + this.innerProperties().withManagementGroups(managementGroups); + return this; + } + + /** + * Get the subscriptions property: The collection of subscriptions covered by the Managed Network. + * + * @return the subscriptions value. + */ + public List subscriptions() { + return this.innerProperties() == null ? null : this.innerProperties().subscriptions(); + } + + /** + * Set the subscriptions property: The collection of subscriptions covered by the Managed Network. + * + * @param subscriptions the subscriptions value to set. + * @return the ManagedNetworkGroupInner object itself. + */ + public ManagedNetworkGroupInner withSubscriptions(List subscriptions) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedNetworkGroupProperties(); + } + this.innerProperties().withSubscriptions(subscriptions); + return this; + } + + /** + * Get the virtualNetworks property: The collection of virtual nets covered by the Managed Network. + * + * @return the virtualNetworks value. + */ + public List virtualNetworks() { + return this.innerProperties() == null ? null : this.innerProperties().virtualNetworks(); + } + + /** + * Set the virtualNetworks property: The collection of virtual nets covered by the Managed Network. + * + * @param virtualNetworks the virtualNetworks value to set. + * @return the ManagedNetworkGroupInner object itself. + */ + public ManagedNetworkGroupInner withVirtualNetworks(List virtualNetworks) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedNetworkGroupProperties(); + } + this.innerProperties().withVirtualNetworks(virtualNetworks); + return this; + } + + /** + * Get the subnets property: The collection of subnets covered by the Managed Network. + * + * @return the subnets value. + */ + public List subnets() { + return this.innerProperties() == null ? null : this.innerProperties().subnets(); + } + + /** + * Set the subnets property: The collection of subnets covered by the Managed Network. + * + * @param subnets the subnets value to set. + * @return the ManagedNetworkGroupInner object itself. + */ + public ManagedNetworkGroupInner withSubnets(List subnets) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedNetworkGroupProperties(); + } + this.innerProperties().withSubnets(subnets); + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + public String etag() { + return this.innerProperties() == null ? null : this.innerProperties().etag(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkGroupProperties.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkGroupProperties.java new file mode 100644 index 0000000000000..bdb5950e37e17 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkGroupProperties.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.models.ResourceId; +import com.azure.resourcemanager.managednetwork.models.ResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a Managed Network Group. */ +@Fluent +public final class ManagedNetworkGroupProperties extends ResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedNetworkGroupProperties.class); + + /* + * The collection of management groups covered by the Managed Network + */ + @JsonProperty(value = "managementGroups") + private List managementGroups; + + /* + * The collection of subscriptions covered by the Managed Network + */ + @JsonProperty(value = "subscriptions") + private List subscriptions; + + /* + * The collection of virtual nets covered by the Managed Network + */ + @JsonProperty(value = "virtualNetworks") + private List virtualNetworks; + + /* + * The collection of subnets covered by the Managed Network + */ + @JsonProperty(value = "subnets") + private List subnets; + + /** + * Get the managementGroups property: The collection of management groups covered by the Managed Network. + * + * @return the managementGroups value. + */ + public List managementGroups() { + return this.managementGroups; + } + + /** + * Set the managementGroups property: The collection of management groups covered by the Managed Network. + * + * @param managementGroups the managementGroups value to set. + * @return the ManagedNetworkGroupProperties object itself. + */ + public ManagedNetworkGroupProperties withManagementGroups(List managementGroups) { + this.managementGroups = managementGroups; + return this; + } + + /** + * Get the subscriptions property: The collection of subscriptions covered by the Managed Network. + * + * @return the subscriptions value. + */ + public List subscriptions() { + return this.subscriptions; + } + + /** + * Set the subscriptions property: The collection of subscriptions covered by the Managed Network. + * + * @param subscriptions the subscriptions value to set. + * @return the ManagedNetworkGroupProperties object itself. + */ + public ManagedNetworkGroupProperties withSubscriptions(List subscriptions) { + this.subscriptions = subscriptions; + return this; + } + + /** + * Get the virtualNetworks property: The collection of virtual nets covered by the Managed Network. + * + * @return the virtualNetworks value. + */ + public List virtualNetworks() { + return this.virtualNetworks; + } + + /** + * Set the virtualNetworks property: The collection of virtual nets covered by the Managed Network. + * + * @param virtualNetworks the virtualNetworks value to set. + * @return the ManagedNetworkGroupProperties object itself. + */ + public ManagedNetworkGroupProperties withVirtualNetworks(List virtualNetworks) { + this.virtualNetworks = virtualNetworks; + return this; + } + + /** + * Get the subnets property: The collection of subnets covered by the Managed Network. + * + * @return the subnets value. + */ + public List subnets() { + return this.subnets; + } + + /** + * Set the subnets property: The collection of subnets covered by the Managed Network. + * + * @param subnets the subnets value to set. + * @return the ManagedNetworkGroupProperties object itself. + */ + public ManagedNetworkGroupProperties withSubnets(List subnets) { + this.subnets = subnets; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (managementGroups() != null) { + managementGroups().forEach(e -> e.validate()); + } + if (subscriptions() != null) { + subscriptions().forEach(e -> e.validate()); + } + if (virtualNetworks() != null) { + virtualNetworks().forEach(e -> e.validate()); + } + if (subnets() != null) { + subnets().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkInner.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkInner.java new file mode 100644 index 0000000000000..bfba1d4cb5094 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkInner.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.models.ConnectivityCollection; +import com.azure.resourcemanager.managednetwork.models.ProvisioningState; +import com.azure.resourcemanager.managednetwork.models.Scope; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The Managed Network resource. */ +@Fluent +public final class ManagedNetworkInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedNetworkInner.class); + + /* + * The MNC properties + */ + @JsonProperty(value = "properties") + private ManagedNetworkProperties innerProperties; + + /** + * Get the innerProperties property: The MNC properties. + * + * @return the innerProperties value. + */ + private ManagedNetworkProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ManagedNetworkInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ManagedNetworkInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the scope property: The collection of management groups, subscriptions, virtual networks, and subnets by the + * Managed Network. This is a read-only property that is reflective of all ScopeAssignments for this Managed + * Network. + * + * @return the scope value. + */ + public Scope scope() { + return this.innerProperties() == null ? null : this.innerProperties().scope(); + } + + /** + * Set the scope property: The collection of management groups, subscriptions, virtual networks, and subnets by the + * Managed Network. This is a read-only property that is reflective of all ScopeAssignments for this Managed + * Network. + * + * @param scope the scope value to set. + * @return the ManagedNetworkInner object itself. + */ + public ManagedNetworkInner withScope(Scope scope) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedNetworkProperties(); + } + this.innerProperties().withScope(scope); + return this; + } + + /** + * Get the connectivity property: The collection of groups and policies concerned with connectivity. + * + * @return the connectivity value. + */ + public ConnectivityCollection connectivity() { + return this.innerProperties() == null ? null : this.innerProperties().connectivity(); + } + + /** + * Get the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + public String etag() { + return this.innerProperties() == null ? null : this.innerProperties().etag(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkPeeringPolicyInner.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkPeeringPolicyInner.java new file mode 100644 index 0000000000000..6a5086dc88e81 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkPeeringPolicyInner.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkPeeringPolicyProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Managed Network Peering Policy resource. */ +@Fluent +public final class ManagedNetworkPeeringPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedNetworkPeeringPolicyInner.class); + + /* + * Gets or sets the properties of a Managed Network Policy + */ + @JsonProperty(value = "properties") + private ManagedNetworkPeeringPolicyProperties properties; + + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the properties property: Gets or sets the properties of a Managed Network Policy. + * + * @return the properties value. + */ + public ManagedNetworkPeeringPolicyProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Gets or sets the properties of a Managed Network Policy. + * + * @param properties the properties value to set. + * @return the ManagedNetworkPeeringPolicyInner object itself. + */ + public ManagedNetworkPeeringPolicyInner withProperties(ManagedNetworkPeeringPolicyProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the ManagedNetworkPeeringPolicyInner object itself. + */ + public ManagedNetworkPeeringPolicyInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkProperties.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkProperties.java new file mode 100644 index 0000000000000..0702cc375645a --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkProperties.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.models.ConnectivityCollection; +import com.azure.resourcemanager.managednetwork.models.ResourceProperties; +import com.azure.resourcemanager.managednetwork.models.Scope; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of Managed Network. */ +@Fluent +public final class ManagedNetworkProperties extends ResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedNetworkProperties.class); + + /* + * The collection of management groups, subscriptions, virtual networks, + * and subnets by the Managed Network. This is a read-only property that is + * reflective of all ScopeAssignments for this Managed Network + */ + @JsonProperty(value = "scope") + private Scope scope; + + /* + * The collection of groups and policies concerned with connectivity + */ + @JsonProperty(value = "connectivity", access = JsonProperty.Access.WRITE_ONLY) + private ConnectivityCollection connectivity; + + /** + * Get the scope property: The collection of management groups, subscriptions, virtual networks, and subnets by the + * Managed Network. This is a read-only property that is reflective of all ScopeAssignments for this Managed + * Network. + * + * @return the scope value. + */ + public Scope scope() { + return this.scope; + } + + /** + * Set the scope property: The collection of management groups, subscriptions, virtual networks, and subnets by the + * Managed Network. This is a read-only property that is reflective of all ScopeAssignments for this Managed + * Network. + * + * @param scope the scope value to set. + * @return the ManagedNetworkProperties object itself. + */ + public ManagedNetworkProperties withScope(Scope scope) { + this.scope = scope; + return this; + } + + /** + * Get the connectivity property: The collection of groups and policies concerned with connectivity. + * + * @return the connectivity value. + */ + public ConnectivityCollection connectivity() { + return this.connectivity; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (scope() != null) { + scope().validate(); + } + if (connectivity() != null) { + connectivity().validate(); + } + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/OperationInner.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..b5029bd3c80a3 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/OperationInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** REST API operation. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Operation name: {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that represents the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ScopeAssignmentInner.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ScopeAssignmentInner.java new file mode 100644 index 0000000000000..38304da698613 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ScopeAssignmentInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Managed Network resource. */ +@Fluent +public final class ScopeAssignmentInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScopeAssignmentInner.class); + + /* + * The Scope Assignment properties + */ + @JsonProperty(value = "properties") + private ScopeAssignmentProperties innerProperties; + + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the innerProperties property: The Scope Assignment properties. + * + * @return the innerProperties value. + */ + private ScopeAssignmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the ScopeAssignmentInner object itself. + */ + public ScopeAssignmentInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the assignedManagedNetwork property: The managed network ID with scope will be assigned to. + * + * @return the assignedManagedNetwork value. + */ + public String assignedManagedNetwork() { + return this.innerProperties() == null ? null : this.innerProperties().assignedManagedNetwork(); + } + + /** + * Set the assignedManagedNetwork property: The managed network ID with scope will be assigned to. + * + * @param assignedManagedNetwork the assignedManagedNetwork value to set. + * @return the ScopeAssignmentInner object itself. + */ + public ScopeAssignmentInner withAssignedManagedNetwork(String assignedManagedNetwork) { + if (this.innerProperties() == null) { + this.innerProperties = new ScopeAssignmentProperties(); + } + this.innerProperties().withAssignedManagedNetwork(assignedManagedNetwork); + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + public String etag() { + return this.innerProperties() == null ? null : this.innerProperties().etag(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ScopeAssignmentProperties.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ScopeAssignmentProperties.java new file mode 100644 index 0000000000000..bcb0bef31fb7e --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ScopeAssignmentProperties.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.managednetwork.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.models.ResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of Managed Network. */ +@Fluent +public final class ScopeAssignmentProperties extends ResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScopeAssignmentProperties.class); + + /* + * The managed network ID with scope will be assigned to. + */ + @JsonProperty(value = "assignedManagedNetwork") + private String assignedManagedNetwork; + + /** + * Get the assignedManagedNetwork property: The managed network ID with scope will be assigned to. + * + * @return the assignedManagedNetwork value. + */ + public String assignedManagedNetwork() { + return this.assignedManagedNetwork; + } + + /** + * Set the assignedManagedNetwork property: The managed network ID with scope will be assigned to. + * + * @param assignedManagedNetwork the assignedManagedNetwork value to set. + * @return the ScopeAssignmentProperties object itself. + */ + public ScopeAssignmentProperties withAssignedManagedNetwork(String assignedManagedNetwork) { + this.assignedManagedNetwork = assignedManagedNetwork; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/package-info.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/package-info.java new file mode 100644 index 0000000000000..a04156403f72e --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/package-info.java @@ -0,0 +1,10 @@ +// 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 ManagedNetworkManagementClient. The Microsoft Azure Managed Network + * management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to + * programmatically view, control, change, and monitor your entire Azure network centrally and with ease. + */ +package com.azure.resourcemanager.managednetwork.fluent.models; diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/package-info.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/package-info.java new file mode 100644 index 0000000000000..da165a3936ae6 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/package-info.java @@ -0,0 +1,10 @@ +// 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 ManagedNetworkManagementClient. The Microsoft Azure Managed Network + * management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to + * programmatically view, control, change, and monitor your entire Azure network centrally and with ease. + */ +package com.azure.resourcemanager.managednetwork.fluent; diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupImpl.java new file mode 100644 index 0000000000000..8dae2aa7edfdd --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupImpl.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkGroupInner; +import com.azure.resourcemanager.managednetwork.models.Kind; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkGroup; +import com.azure.resourcemanager.managednetwork.models.ProvisioningState; +import com.azure.resourcemanager.managednetwork.models.ResourceId; +import java.util.Collections; +import java.util.List; + +public final class ManagedNetworkGroupImpl + implements ManagedNetworkGroup, ManagedNetworkGroup.Definition, ManagedNetworkGroup.Update { + private ManagedNetworkGroupInner innerObject; + + private final com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Kind kind() { + return this.innerModel().kind(); + } + + public List managementGroups() { + List inner = this.innerModel().managementGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List subscriptions() { + List inner = this.innerModel().subscriptions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List virtualNetworks() { + List inner = this.innerModel().virtualNetworks(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List subnets() { + List inner = this.innerModel().subnets(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public ManagedNetworkGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedNetworkName; + + private String managedNetworkGroupName; + + public ManagedNetworkGroupImpl withExistingManagedNetwork(String resourceGroupName, String managedNetworkName) { + this.resourceGroupName = resourceGroupName; + this.managedNetworkName = managedNetworkName; + return this; + } + + public ManagedNetworkGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworkGroups() + .createOrUpdate( + resourceGroupName, managedNetworkName, managedNetworkGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedNetworkGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworkGroups() + .createOrUpdate( + resourceGroupName, managedNetworkName, managedNetworkGroupName, this.innerModel(), context); + return this; + } + + ManagedNetworkGroupImpl( + String name, com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerObject = new ManagedNetworkGroupInner(); + this.serviceManager = serviceManager; + this.managedNetworkGroupName = name; + } + + public ManagedNetworkGroupImpl update() { + return this; + } + + public ManagedNetworkGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworkGroups() + .createOrUpdate( + resourceGroupName, managedNetworkName, managedNetworkGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedNetworkGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworkGroups() + .createOrUpdate( + resourceGroupName, managedNetworkName, managedNetworkGroupName, this.innerModel(), context); + return this; + } + + ManagedNetworkGroupImpl( + ManagedNetworkGroupInner innerObject, + com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedNetworkName = Utils.getValueFromIdByName(innerObject.id(), "managedNetworks"); + this.managedNetworkGroupName = Utils.getValueFromIdByName(innerObject.id(), "managedNetworkGroups"); + } + + public ManagedNetworkGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworkGroups() + .getWithResponse(resourceGroupName, managedNetworkName, managedNetworkGroupName, Context.NONE) + .getValue(); + return this; + } + + public ManagedNetworkGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworkGroups() + .getWithResponse(resourceGroupName, managedNetworkName, managedNetworkGroupName, context) + .getValue(); + return this; + } + + public ManagedNetworkGroupImpl withKind(Kind kind) { + this.innerModel().withKind(kind); + return this; + } + + public ManagedNetworkGroupImpl withManagementGroups(List managementGroups) { + this.innerModel().withManagementGroups(managementGroups); + return this; + } + + public ManagedNetworkGroupImpl withSubscriptions(List subscriptions) { + this.innerModel().withSubscriptions(subscriptions); + return this; + } + + public ManagedNetworkGroupImpl withVirtualNetworks(List virtualNetworks) { + this.innerModel().withVirtualNetworks(virtualNetworks); + return this; + } + + public ManagedNetworkGroupImpl withSubnets(List subnets) { + this.innerModel().withSubnets(subnets); + return this; + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupsClientImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupsClientImpl.java new file mode 100644 index 0000000000000..735eaa6117f65 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupsClientImpl.java @@ -0,0 +1,1252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.managednetwork.fluent.ManagedNetworkGroupsClient; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkGroupInner; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkGroupListResult; +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 ManagedNetworkGroupsClient. */ +public final class ManagedNetworkGroupsClientImpl implements ManagedNetworkGroupsClient { + private final ClientLogger logger = new ClientLogger(ManagedNetworkGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedNetworkGroupsService service; + + /** The service client containing this operation class. */ + private final ManagedNetworkManagementClientImpl client; + + /** + * Initializes an instance of ManagedNetworkGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedNetworkGroupsClientImpl(ManagedNetworkManagementClientImpl client) { + this.service = + RestProxy + .create(ManagedNetworkGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedNetworkManagementClientManagedNetworkGroups to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedNetworkManage") + private interface ManagedNetworkGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork" + + "/managedNetworks/{managedNetworkName}/managedNetworkGroups/{managedNetworkGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedNetworkName") String managedNetworkName, + @PathParam("managedNetworkGroupName") String managedNetworkGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork" + + "/managedNetworks/{managedNetworkName}/managedNetworkGroups/{managedNetworkGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedNetworkName") String managedNetworkName, + @PathParam("managedNetworkGroupName") String managedNetworkGroupName, + @BodyParam("application/json") ManagedNetworkGroupInner managedNetworkGroup, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork" + + "/managedNetworks/{managedNetworkName}/managedNetworkGroups/{managedNetworkGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedNetworkName") String managedNetworkName, + @PathParam("managedNetworkGroupName") String managedNetworkGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork" + + "/managedNetworks/{managedNetworkName}/managedNetworkGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedNetwork( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedNetworkName") String managedNetworkName, + @QueryParam("$top") Integer top, + @QueryParam("$skiptoken") String skiptoken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedNetworkNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The Get ManagedNetworkGroups operation gets a Managed Network Group specified by the resource group, Managed + * Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the Managed Network Group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName) { + 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetworkGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter managedNetworkGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetworkGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The Get ManagedNetworkGroups operation gets a Managed Network Group specified by the resource group, Managed + * Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the Managed Network Group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetworkGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter managedNetworkGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetworkGroupName, + accept, + context); + } + + /** + * The Get ManagedNetworkGroups operation gets a Managed Network Group specified by the resource group, Managed + * Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the Managed Network Group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName) { + return getWithResponseAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The Get ManagedNetworkGroups operation gets a Managed Network Group specified by the resource group, Managed + * Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the Managed Network Group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedNetworkGroupInner get( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName) { + return getAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName).block(); + } + + /** + * The Get ManagedNetworkGroups operation gets a Managed Network Group specified by the resource group, Managed + * Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the Managed Network Group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName, context).block(); + } + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group 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 Managed Network Group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup) { + 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetworkGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter managedNetworkGroupName is required and cannot be null.")); + } + if (managedNetworkGroup == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkGroup is required and cannot be null.")); + } else { + managedNetworkGroup.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetworkGroupName, + managedNetworkGroup, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group 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 Managed Network Group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup, + 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetworkGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter managedNetworkGroupName is required and cannot be null.")); + } + if (managedNetworkGroup == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkGroup is required and cannot be null.")); + } else { + managedNetworkGroup.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetworkGroupName, + managedNetworkGroup, + accept, + context); + } + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Managed Network Group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedNetworkGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedNetworkName, managedNetworkGroupName, managedNetworkGroup); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedNetworkGroupInner.class, + ManagedNetworkGroupInner.class, + this.client.getContext()); + } + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Managed Network Group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedNetworkGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedNetworkName, managedNetworkGroupName, managedNetworkGroup, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedNetworkGroupInner.class, + ManagedNetworkGroupInner.class, + context); + } + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Managed Network Group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedNetworkGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedNetworkName, managedNetworkGroupName, managedNetworkGroup) + .getSyncPoller(); + } + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Managed Network Group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedNetworkGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedNetworkName, managedNetworkGroupName, managedNetworkGroup, context) + .getSyncPoller(); + } + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group 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 Managed Network Group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedNetworkName, managedNetworkGroupName, managedNetworkGroup) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group 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 Managed Network Group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedNetworkName, managedNetworkGroupName, managedNetworkGroup, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group 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 Managed Network Group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedNetworkGroupInner createOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup) { + return createOrUpdateAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName, managedNetworkGroup) + .block(); + } + + /** + * The Put ManagedNetworkGroups operation creates or updates a Managed Network Group resource. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network Group. + * @param managedNetworkGroup Parameters supplied to the create/update a Managed Network Group 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 Managed Network Group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedNetworkGroupInner createOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkGroupName, + ManagedNetworkGroupInner managedNetworkGroup, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedNetworkName, managedNetworkGroupName, managedNetworkGroup, context) + .block(); + } + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName) { + 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetworkGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter managedNetworkGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetworkGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetworkGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter managedNetworkGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetworkGroupName, + accept, + context); + } + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName) { + return beginDeleteAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName).getSyncPoller(); + } + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName, context) + .getSyncPoller(); + } + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName) { + return beginDeleteAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedNetworkName, String managedNetworkGroupName) { + deleteAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName).block(); + } + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, Context context) { + deleteAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName, context).block(); + } + + /** + * The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the Managed Network Groups in a specified + * Managed Networks in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Groups along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedNetworkSinglePageAsync( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken) { + 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByManagedNetwork( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + top, + skiptoken, + 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())); + } + + /** + * The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the Managed Network Groups in a specified + * Managed Networks in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Groups along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedNetworkSinglePageAsync( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken, 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedNetwork( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + top, + skiptoken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the Managed Network Groups in a specified + * Managed Networks in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedNetworkAsync( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken) { + return new PagedFlux<>( + () -> listByManagedNetworkSinglePageAsync(resourceGroupName, managedNetworkName, top, skiptoken), + nextLink -> listByManagedNetworkNextSinglePageAsync(nextLink)); + } + + /** + * The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the Managed Network Groups in a specified + * Managed Networks in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedNetworkAsync( + String resourceGroupName, String managedNetworkName) { + final Integer top = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> listByManagedNetworkSinglePageAsync(resourceGroupName, managedNetworkName, top, skiptoken), + nextLink -> listByManagedNetworkNextSinglePageAsync(nextLink)); + } + + /** + * The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the Managed Network Groups in a specified + * Managed Networks in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedNetworkAsync( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken, Context context) { + return new PagedFlux<>( + () -> listByManagedNetworkSinglePageAsync(resourceGroupName, managedNetworkName, top, skiptoken, context), + nextLink -> listByManagedNetworkNextSinglePageAsync(nextLink, context)); + } + + /** + * The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the Managed Network Groups in a specified + * Managed Networks in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName) { + final Integer top = null; + final String skiptoken = null; + return new PagedIterable<>(listByManagedNetworkAsync(resourceGroupName, managedNetworkName, top, skiptoken)); + } + + /** + * The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the Managed Network Groups in a specified + * Managed Networks in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken, Context context) { + return new PagedIterable<>( + listByManagedNetworkAsync(resourceGroupName, managedNetworkName, top, skiptoken, 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 result of the request to list Managed Network Groups along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedNetworkNextSinglePageAsync(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.listByManagedNetworkNext(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 result of the request to list Managed Network Groups along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedNetworkNextSinglePageAsync( + 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 + .listByManagedNetworkNext(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/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupsImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupsImpl.java new file mode 100644 index 0000000000000..405a79ac2d3b9 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupsImpl.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.managednetwork.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.managednetwork.fluent.ManagedNetworkGroupsClient; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkGroupInner; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkGroup; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedNetworkGroupsImpl implements ManagedNetworkGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedNetworkGroupsImpl.class); + + private final ManagedNetworkGroupsClient innerClient; + + private final com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager; + + public ManagedNetworkGroupsImpl( + ManagedNetworkGroupsClient innerClient, + com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedNetworkGroup get( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName) { + ManagedNetworkGroupInner inner = + this.serviceClient().get(resourceGroupName, managedNetworkName, managedNetworkGroupName); + if (inner != null) { + return new ManagedNetworkGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedNetworkName, managedNetworkGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedNetworkGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedNetworkName, String managedNetworkGroupName) { + this.serviceClient().delete(resourceGroupName, managedNetworkName, managedNetworkGroupName); + } + + public void delete( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, managedNetworkName, managedNetworkGroupName, context); + } + + public PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName) { + PagedIterable inner = + this.serviceClient().listByManagedNetwork(resourceGroupName, managedNetworkName); + return Utils.mapPage(inner, inner1 -> new ManagedNetworkGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken, Context context) { + PagedIterable inner = + this.serviceClient().listByManagedNetwork(resourceGroupName, managedNetworkName, top, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new ManagedNetworkGroupImpl(inner1, this.manager())); + } + + public ManagedNetworkGroup 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 managedNetworkName = Utils.getValueFromIdByName(id, "managedNetworks"); + if (managedNetworkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'managedNetworks'.", id))); + } + String managedNetworkGroupName = Utils.getValueFromIdByName(id, "managedNetworkGroups"); + if (managedNetworkGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedNetworkGroups'.", + id))); + } + return this + .getWithResponse(resourceGroupName, managedNetworkName, managedNetworkGroupName, 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 managedNetworkName = Utils.getValueFromIdByName(id, "managedNetworks"); + if (managedNetworkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'managedNetworks'.", id))); + } + String managedNetworkGroupName = Utils.getValueFromIdByName(id, "managedNetworkGroups"); + if (managedNetworkGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedNetworkGroups'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedNetworkName, managedNetworkGroupName, 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 managedNetworkName = Utils.getValueFromIdByName(id, "managedNetworks"); + if (managedNetworkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'managedNetworks'.", id))); + } + String managedNetworkGroupName = Utils.getValueFromIdByName(id, "managedNetworkGroups"); + if (managedNetworkGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedNetworkGroups'.", + id))); + } + this.delete(resourceGroupName, managedNetworkName, managedNetworkGroupName, 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 managedNetworkName = Utils.getValueFromIdByName(id, "managedNetworks"); + if (managedNetworkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'managedNetworks'.", id))); + } + String managedNetworkGroupName = Utils.getValueFromIdByName(id, "managedNetworkGroups"); + if (managedNetworkGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedNetworkGroups'.", + id))); + } + this.delete(resourceGroupName, managedNetworkName, managedNetworkGroupName, context); + } + + private ManagedNetworkGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager() { + return this.serviceManager; + } + + public ManagedNetworkGroupImpl define(String name) { + return new ManagedNetworkGroupImpl(name, this.manager()); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkImpl.java new file mode 100644 index 0000000000000..51056d227937a --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkInner; +import com.azure.resourcemanager.managednetwork.models.ConnectivityCollection; +import com.azure.resourcemanager.managednetwork.models.ManagedNetwork; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkUpdate; +import com.azure.resourcemanager.managednetwork.models.ProvisioningState; +import com.azure.resourcemanager.managednetwork.models.Scope; +import java.util.Collections; +import java.util.Map; + +public final class ManagedNetworkImpl implements ManagedNetwork, ManagedNetwork.Definition, ManagedNetwork.Update { + private ManagedNetworkInner innerObject; + + private final com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Scope scope() { + return this.innerModel().scope(); + } + + public ConnectivityCollection connectivity() { + return this.innerModel().connectivity(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ManagedNetworkInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedNetworkName; + + private ManagedNetworkUpdate updateParameters; + + public ManagedNetworkImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ManagedNetwork create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworks() + .createOrUpdateWithResponse(resourceGroupName, managedNetworkName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ManagedNetwork create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworks() + .createOrUpdateWithResponse(resourceGroupName, managedNetworkName, this.innerModel(), context) + .getValue(); + return this; + } + + ManagedNetworkImpl(String name, com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerObject = new ManagedNetworkInner(); + this.serviceManager = serviceManager; + this.managedNetworkName = name; + } + + public ManagedNetworkImpl update() { + this.updateParameters = new ManagedNetworkUpdate(); + return this; + } + + public ManagedNetwork apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworks() + .update(resourceGroupName, managedNetworkName, updateParameters, Context.NONE); + return this; + } + + public ManagedNetwork apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworks() + .update(resourceGroupName, managedNetworkName, updateParameters, context); + return this; + } + + ManagedNetworkImpl( + ManagedNetworkInner innerObject, + com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedNetworkName = Utils.getValueFromIdByName(innerObject.id(), "managedNetworks"); + } + + public ManagedNetwork refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworks() + .getByResourceGroupWithResponse(resourceGroupName, managedNetworkName, Context.NONE) + .getValue(); + return this; + } + + public ManagedNetwork refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworks() + .getByResourceGroupWithResponse(resourceGroupName, managedNetworkName, context) + .getValue(); + return this; + } + + public ManagedNetworkImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ManagedNetworkImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ManagedNetworkImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ManagedNetworkImpl withScope(Scope scope) { + this.innerModel().withScope(scope); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkManagementClientBuilder.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkManagementClientBuilder.java new file mode 100644 index 0000000000000..71a4f8363f74e --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkManagementClientBuilder.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.managednetwork.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.CookiePolicy; +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 ManagedNetworkManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ManagedNetworkManagementClientImpl.class}) +public final class ManagedNetworkManagementClientBuilder { + /* + * Gets subscription credentials which uniquely identify Microsoft Azure + * subscription. The subscription ID forms part of the URI for every + * service call. + */ + private String subscriptionId; + + /** + * Sets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID + * forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the ManagedNetworkManagementClientBuilder. + */ + public ManagedNetworkManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ManagedNetworkManagementClientBuilder. + */ + public ManagedNetworkManagementClientBuilder 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 ManagedNetworkManagementClientBuilder. + */ + public ManagedNetworkManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 ManagedNetworkManagementClientBuilder. + */ + public ManagedNetworkManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 ManagedNetworkManagementClientBuilder. + */ + public ManagedNetworkManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + 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 ManagedNetworkManagementClientBuilder. + */ + public ManagedNetworkManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ManagedNetworkManagementClientImpl with the provided parameters. + * + * @return an instance of ManagedNetworkManagementClientImpl. + */ + public ManagedNetworkManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + ManagedNetworkManagementClientImpl client = + new ManagedNetworkManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkManagementClientImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkManagementClientImpl.java new file mode 100644 index 0000000000000..2823dbfea5932 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkManagementClientImpl.java @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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.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.managednetwork.fluent.ManagedNetworkGroupsClient; +import com.azure.resourcemanager.managednetwork.fluent.ManagedNetworkManagementClient; +import com.azure.resourcemanager.managednetwork.fluent.ManagedNetworkPeeringPoliciesClient; +import com.azure.resourcemanager.managednetwork.fluent.ManagedNetworksClient; +import com.azure.resourcemanager.managednetwork.fluent.OperationsClient; +import com.azure.resourcemanager.managednetwork.fluent.ScopeAssignmentsClient; +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 java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the ManagedNetworkManagementClientImpl type. */ +@ServiceClient(builder = ManagedNetworkManagementClientBuilder.class) +public final class ManagedNetworkManagementClientImpl implements ManagedNetworkManagementClient { + private final ClientLogger logger = new ClientLogger(ManagedNetworkManagementClientImpl.class); + + /** + * Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + */ + private final String subscriptionId; + + /** + * Gets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID + * forms part of the URI for every service call. + * + * @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 ManagedNetworksClient object to access its operations. */ + private final ManagedNetworksClient managedNetworks; + + /** + * Gets the ManagedNetworksClient object to access its operations. + * + * @return the ManagedNetworksClient object. + */ + public ManagedNetworksClient getManagedNetworks() { + return this.managedNetworks; + } + + /** The ScopeAssignmentsClient object to access its operations. */ + private final ScopeAssignmentsClient scopeAssignments; + + /** + * Gets the ScopeAssignmentsClient object to access its operations. + * + * @return the ScopeAssignmentsClient object. + */ + public ScopeAssignmentsClient getScopeAssignments() { + return this.scopeAssignments; + } + + /** The ManagedNetworkGroupsClient object to access its operations. */ + private final ManagedNetworkGroupsClient managedNetworkGroups; + + /** + * Gets the ManagedNetworkGroupsClient object to access its operations. + * + * @return the ManagedNetworkGroupsClient object. + */ + public ManagedNetworkGroupsClient getManagedNetworkGroups() { + return this.managedNetworkGroups; + } + + /** The ManagedNetworkPeeringPoliciesClient object to access its operations. */ + private final ManagedNetworkPeeringPoliciesClient managedNetworkPeeringPolicies; + + /** + * Gets the ManagedNetworkPeeringPoliciesClient object to access its operations. + * + * @return the ManagedNetworkPeeringPoliciesClient object. + */ + public ManagedNetworkPeeringPoliciesClient getManagedNetworkPeeringPolicies() { + return this.managedNetworkPeeringPolicies; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * Initializes an instance of ManagedNetworkManagementClient 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 Gets subscription credentials which uniquely identify Microsoft Azure subscription. The + * subscription ID forms part of the URI for every service call. + * @param endpoint server parameter. + */ + ManagedNetworkManagementClientImpl( + 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 = "2019-06-01-preview"; + this.managedNetworks = new ManagedNetworksClientImpl(this); + this.scopeAssignments = new ScopeAssignmentsClientImpl(this); + this.managedNetworkGroups = new ManagedNetworkGroupsClientImpl(this); + this.managedNetworkPeeringPolicies = new ManagedNetworkPeeringPoliciesClientImpl(this); + this.operations = new OperationsClientImpl(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) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return 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)); + } + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPoliciesClientImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPoliciesClientImpl.java new file mode 100644 index 0000000000000..0e37d88fe08d2 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPoliciesClientImpl.java @@ -0,0 +1,1280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.managednetwork.fluent.ManagedNetworkPeeringPoliciesClient; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkPeeringPolicyInner; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkPeeringPolicyListResult; +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 ManagedNetworkPeeringPoliciesClient. */ +public final class ManagedNetworkPeeringPoliciesClientImpl implements ManagedNetworkPeeringPoliciesClient { + private final ClientLogger logger = new ClientLogger(ManagedNetworkPeeringPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedNetworkPeeringPoliciesService service; + + /** The service client containing this operation class. */ + private final ManagedNetworkManagementClientImpl client; + + /** + * Initializes an instance of ManagedNetworkPeeringPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedNetworkPeeringPoliciesClientImpl(ManagedNetworkManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedNetworkPeeringPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedNetworkManagementClientManagedNetworkPeeringPolicies to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedNetworkManage") + private interface ManagedNetworkPeeringPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork" + + "/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies" + + "/{managedNetworkPeeringPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedNetworkName") String managedNetworkName, + @PathParam("managedNetworkPeeringPolicyName") String managedNetworkPeeringPolicyName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork" + + "/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies" + + "/{managedNetworkPeeringPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedNetworkName") String managedNetworkName, + @PathParam("managedNetworkPeeringPolicyName") String managedNetworkPeeringPolicyName, + @BodyParam("application/json") ManagedNetworkPeeringPolicyInner managedNetworkPolicy, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork" + + "/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies" + + "/{managedNetworkPeeringPolicyName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedNetworkName") String managedNetworkName, + @PathParam("managedNetworkPeeringPolicyName") String managedNetworkPeeringPolicyName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork" + + "/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedNetwork( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedNetworkName") String managedNetworkName, + @QueryParam("$top") Integer top, + @QueryParam("$skiptoken") String skiptoken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedNetworkNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The Get ManagedNetworkPeeringPolicies operation gets a Managed Network Peering Policy resource, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedNetworkName, String managedNetworkPeeringPolicyName) { + 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetworkPeeringPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter managedNetworkPeeringPolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetworkPeeringPolicyName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The Get ManagedNetworkPeeringPolicies operation gets a Managed Network Peering Policy resource, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedNetworkName, String managedNetworkPeeringPolicyName, 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetworkPeeringPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter managedNetworkPeeringPolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetworkPeeringPolicyName, + accept, + context); + } + + /** + * The Get ManagedNetworkPeeringPolicies operation gets a Managed Network Peering Policy resource, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedNetworkName, String managedNetworkPeeringPolicyName) { + return getWithResponseAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The Get ManagedNetworkPeeringPolicies operation gets a Managed Network Peering Policy resource, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedNetworkPeeringPolicyInner get( + String resourceGroupName, String managedNetworkName, String managedNetworkPeeringPolicyName) { + return getAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName).block(); + } + + /** + * The Get ManagedNetworkPeeringPolicies operation gets a Managed Network Peering Policy resource, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedNetworkName, String managedNetworkPeeringPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, context) + .block(); + } + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy) { + 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetworkPeeringPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter managedNetworkPeeringPolicyName is required and cannot be null.")); + } + if (managedNetworkPolicy == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkPolicy is required and cannot be null.")); + } else { + managedNetworkPolicy.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetworkPeeringPolicyName, + managedNetworkPolicy, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy, + 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetworkPeeringPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter managedNetworkPeeringPolicyName is required and cannot be null.")); + } + if (managedNetworkPolicy == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkPolicy is required and cannot be null.")); + } else { + managedNetworkPolicy.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetworkPeeringPolicyName, + managedNetworkPolicy, + accept, + context); + } + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 the Managed Network Peering Policy resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedNetworkPeeringPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, managedNetworkPolicy); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedNetworkPeeringPolicyInner.class, + ManagedNetworkPeeringPolicyInner.class, + this.client.getContext()); + } + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 the Managed Network Peering Policy resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedNetworkPeeringPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, managedNetworkPolicy, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedNetworkPeeringPolicyInner.class, + ManagedNetworkPeeringPolicyInner.class, + context); + } + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 the Managed Network Peering Policy resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedNetworkPeeringPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, managedNetworkPolicy) + .getSyncPoller(); + } + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 the Managed Network Peering Policy resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedNetworkPeeringPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, managedNetworkPolicy, context) + .getSyncPoller(); + } + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, managedNetworkPolicy) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, managedNetworkPolicy, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedNetworkPeeringPolicyInner createOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy) { + return createOrUpdateAsync( + resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, managedNetworkPolicy) + .block(); + } + + /** + * The Put ManagedNetworkPeeringPolicies operation creates/updates a new Managed Network Peering Policy. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param managedNetworkPolicy Parameters supplied to create/update a Managed Network Peering Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedNetworkPeeringPolicyInner createOrUpdate( + String resourceGroupName, + String managedNetworkName, + String managedNetworkPeeringPolicyName, + ManagedNetworkPeeringPolicyInner managedNetworkPolicy, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, managedNetworkPolicy, context) + .block(); + } + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 managedNetworkName, String managedNetworkPeeringPolicyName) { + 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetworkPeeringPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter managedNetworkPeeringPolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetworkPeeringPolicyName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 managedNetworkName, String managedNetworkPeeringPolicyName, 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetworkPeeringPolicyName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter managedNetworkPeeringPolicyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetworkPeeringPolicyName, + accept, + context); + } + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 managedNetworkName, String managedNetworkPeeringPolicyName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 managedNetworkName, String managedNetworkPeeringPolicyName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 managedNetworkName, String managedNetworkPeeringPolicyName) { + return beginDeleteAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName).getSyncPoller(); + } + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 managedNetworkName, String managedNetworkPeeringPolicyName, Context context) { + return beginDeleteAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, context) + .getSyncPoller(); + } + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedNetworkName, String managedNetworkPeeringPolicyName) { + return beginDeleteAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedNetworkName, String managedNetworkPeeringPolicyName, Context context) { + return beginDeleteAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 managedNetworkName, String managedNetworkPeeringPolicyName) { + deleteAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName).block(); + } + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 managedNetworkName, String managedNetworkPeeringPolicyName, Context context) { + deleteAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, context).block(); + } + + /** + * The ListByManagedNetwork PeeringPolicies operation retrieves all the Managed Network Peering Policies in a + * specified Managed Network, in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Peering Policies along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedNetworkSinglePageAsync( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken) { + 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByManagedNetwork( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + top, + skiptoken, + 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())); + } + + /** + * The ListByManagedNetwork PeeringPolicies operation retrieves all the Managed Network Peering Policies in a + * specified Managed Network, in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Peering Policies along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedNetworkSinglePageAsync( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken, 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedNetwork( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + top, + skiptoken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * The ListByManagedNetwork PeeringPolicies operation retrieves all the Managed Network Peering Policies in a + * specified Managed Network, in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Peering Policies as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedNetworkAsync( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken) { + return new PagedFlux<>( + () -> listByManagedNetworkSinglePageAsync(resourceGroupName, managedNetworkName, top, skiptoken), + nextLink -> listByManagedNetworkNextSinglePageAsync(nextLink)); + } + + /** + * The ListByManagedNetwork PeeringPolicies operation retrieves all the Managed Network Peering Policies in a + * specified Managed Network, in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Peering Policies as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedNetworkAsync( + String resourceGroupName, String managedNetworkName) { + final Integer top = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> listByManagedNetworkSinglePageAsync(resourceGroupName, managedNetworkName, top, skiptoken), + nextLink -> listByManagedNetworkNextSinglePageAsync(nextLink)); + } + + /** + * The ListByManagedNetwork PeeringPolicies operation retrieves all the Managed Network Peering Policies in a + * specified Managed Network, in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Peering Policies as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedNetworkAsync( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken, Context context) { + return new PagedFlux<>( + () -> listByManagedNetworkSinglePageAsync(resourceGroupName, managedNetworkName, top, skiptoken, context), + nextLink -> listByManagedNetworkNextSinglePageAsync(nextLink, context)); + } + + /** + * The ListByManagedNetwork PeeringPolicies operation retrieves all the Managed Network Peering Policies in a + * specified Managed Network, in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Peering Policies as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName) { + final Integer top = null; + final String skiptoken = null; + return new PagedIterable<>(listByManagedNetworkAsync(resourceGroupName, managedNetworkName, top, skiptoken)); + } + + /** + * The ListByManagedNetwork PeeringPolicies operation retrieves all the Managed Network Peering Policies in a + * specified Managed Network, in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Peering Policies as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken, Context context) { + return new PagedIterable<>( + listByManagedNetworkAsync(resourceGroupName, managedNetworkName, top, skiptoken, 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 result of the request to list Managed Network Peering Policies along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedNetworkNextSinglePageAsync( + 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.listByManagedNetworkNext(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 result of the request to list Managed Network Peering Policies along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedNetworkNextSinglePageAsync( + 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 + .listByManagedNetworkNext(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/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPoliciesImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPoliciesImpl.java new file mode 100644 index 0000000000000..186f47068f581 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPoliciesImpl.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.managednetwork.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.managednetwork.fluent.ManagedNetworkPeeringPoliciesClient; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkPeeringPolicyInner; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkPeeringPolicies; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkPeeringPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedNetworkPeeringPoliciesImpl implements ManagedNetworkPeeringPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedNetworkPeeringPoliciesImpl.class); + + private final ManagedNetworkPeeringPoliciesClient innerClient; + + private final com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager; + + public ManagedNetworkPeeringPoliciesImpl( + ManagedNetworkPeeringPoliciesClient innerClient, + com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedNetworkPeeringPolicy get( + String resourceGroupName, String managedNetworkName, String managedNetworkPeeringPolicyName) { + ManagedNetworkPeeringPolicyInner inner = + this.serviceClient().get(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName); + if (inner != null) { + return new ManagedNetworkPeeringPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedNetworkName, String managedNetworkPeeringPolicyName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedNetworkPeeringPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedNetworkName, String managedNetworkPeeringPolicyName) { + this.serviceClient().delete(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName); + } + + public void delete( + String resourceGroupName, String managedNetworkName, String managedNetworkPeeringPolicyName, Context context) { + this.serviceClient().delete(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, context); + } + + public PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName) { + PagedIterable inner = + this.serviceClient().listByManagedNetwork(resourceGroupName, managedNetworkName); + return Utils.mapPage(inner, inner1 -> new ManagedNetworkPeeringPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken, Context context) { + PagedIterable inner = + this.serviceClient().listByManagedNetwork(resourceGroupName, managedNetworkName, top, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new ManagedNetworkPeeringPolicyImpl(inner1, this.manager())); + } + + public ManagedNetworkPeeringPolicy 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 managedNetworkName = Utils.getValueFromIdByName(id, "managedNetworks"); + if (managedNetworkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'managedNetworks'.", id))); + } + String managedNetworkPeeringPolicyName = Utils.getValueFromIdByName(id, "managedNetworkPeeringPolicies"); + if (managedNetworkPeeringPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'managedNetworkPeeringPolicies'.", + id))); + } + return this + .getWithResponse(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, 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 managedNetworkName = Utils.getValueFromIdByName(id, "managedNetworks"); + if (managedNetworkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'managedNetworks'.", id))); + } + String managedNetworkPeeringPolicyName = Utils.getValueFromIdByName(id, "managedNetworkPeeringPolicies"); + if (managedNetworkPeeringPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'managedNetworkPeeringPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, 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 managedNetworkName = Utils.getValueFromIdByName(id, "managedNetworks"); + if (managedNetworkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'managedNetworks'.", id))); + } + String managedNetworkPeeringPolicyName = Utils.getValueFromIdByName(id, "managedNetworkPeeringPolicies"); + if (managedNetworkPeeringPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'managedNetworkPeeringPolicies'.", + id))); + } + this.delete(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, 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 managedNetworkName = Utils.getValueFromIdByName(id, "managedNetworks"); + if (managedNetworkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'managedNetworks'.", id))); + } + String managedNetworkPeeringPolicyName = Utils.getValueFromIdByName(id, "managedNetworkPeeringPolicies"); + if (managedNetworkPeeringPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'managedNetworkPeeringPolicies'.", + id))); + } + this.delete(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, context); + } + + private ManagedNetworkPeeringPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager() { + return this.serviceManager; + } + + public ManagedNetworkPeeringPolicyImpl define(String name) { + return new ManagedNetworkPeeringPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPolicyImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPolicyImpl.java new file mode 100644 index 0000000000000..05b5883f99667 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPolicyImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkPeeringPolicyInner; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkPeeringPolicy; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkPeeringPolicyProperties; + +public final class ManagedNetworkPeeringPolicyImpl + implements ManagedNetworkPeeringPolicy, ManagedNetworkPeeringPolicy.Definition, ManagedNetworkPeeringPolicy.Update { + private ManagedNetworkPeeringPolicyInner innerObject; + + private final com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ManagedNetworkPeeringPolicyProperties properties() { + return this.innerModel().properties(); + } + + public String location() { + return this.innerModel().location(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ManagedNetworkPeeringPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedNetworkName; + + private String managedNetworkPeeringPolicyName; + + public ManagedNetworkPeeringPolicyImpl withExistingManagedNetwork( + String resourceGroupName, String managedNetworkName) { + this.resourceGroupName = resourceGroupName; + this.managedNetworkName = managedNetworkName; + return this; + } + + public ManagedNetworkPeeringPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworkPeeringPolicies() + .createOrUpdate( + resourceGroupName, + managedNetworkName, + managedNetworkPeeringPolicyName, + this.innerModel(), + Context.NONE); + return this; + } + + public ManagedNetworkPeeringPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworkPeeringPolicies() + .createOrUpdate( + resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, this.innerModel(), context); + return this; + } + + ManagedNetworkPeeringPolicyImpl( + String name, com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerObject = new ManagedNetworkPeeringPolicyInner(); + this.serviceManager = serviceManager; + this.managedNetworkPeeringPolicyName = name; + } + + public ManagedNetworkPeeringPolicyImpl update() { + return this; + } + + public ManagedNetworkPeeringPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworkPeeringPolicies() + .createOrUpdate( + resourceGroupName, + managedNetworkName, + managedNetworkPeeringPolicyName, + this.innerModel(), + Context.NONE); + return this; + } + + public ManagedNetworkPeeringPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworkPeeringPolicies() + .createOrUpdate( + resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, this.innerModel(), context); + return this; + } + + ManagedNetworkPeeringPolicyImpl( + ManagedNetworkPeeringPolicyInner innerObject, + com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedNetworkName = Utils.getValueFromIdByName(innerObject.id(), "managedNetworks"); + this.managedNetworkPeeringPolicyName = + Utils.getValueFromIdByName(innerObject.id(), "managedNetworkPeeringPolicies"); + } + + public ManagedNetworkPeeringPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworkPeeringPolicies() + .getWithResponse(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, Context.NONE) + .getValue(); + return this; + } + + public ManagedNetworkPeeringPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedNetworkPeeringPolicies() + .getWithResponse(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, context) + .getValue(); + return this; + } + + public ManagedNetworkPeeringPolicyImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ManagedNetworkPeeringPolicyImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ManagedNetworkPeeringPolicyImpl withProperties(ManagedNetworkPeeringPolicyProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworksClientImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworksClientImpl.java new file mode 100644 index 0000000000000..ee705836e64af --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworksClientImpl.java @@ -0,0 +1,1590 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.managednetwork.fluent.ManagedNetworksClient; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkInner; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkListResult; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkUpdate; +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 ManagedNetworksClient. */ +public final class ManagedNetworksClientImpl implements ManagedNetworksClient { + private final ClientLogger logger = new ClientLogger(ManagedNetworksClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagedNetworksService service; + + /** The service client containing this operation class. */ + private final ManagedNetworkManagementClientImpl client; + + /** + * Initializes an instance of ManagedNetworksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedNetworksClientImpl(ManagedNetworkManagementClientImpl client) { + this.service = + RestProxy.create(ManagedNetworksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedNetworkManagementClientManagedNetworks to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedNetworkManage") + private interface ManagedNetworksService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork" + + "/managedNetworks/{managedNetworkName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedNetworkName") String managedNetworkName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork" + + "/managedNetworks/{managedNetworkName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedNetworkName") String managedNetworkName, + @BodyParam("application/json") ManagedNetworkInner managedNetwork, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork" + + "/managedNetworks/{managedNetworkName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedNetworkName") String managedNetworkName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork" + + "/managedNetworks/{managedNetworkName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedNetworkName") String managedNetworkName, + @BodyParam("application/json") ManagedNetworkUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork" + + "/managedNetworks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$top") Integer top, + @QueryParam("$skiptoken") String skiptoken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetwork/managedNetworks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, + @QueryParam("$skiptoken") String skiptoken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed + * Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String managedNetworkName) { + 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed + * Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String managedNetworkName, 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + accept, + context); + } + + /** + * The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed + * Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String managedNetworkName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, managedNetworkName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed + * Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedNetworkInner getByResourceGroup(String resourceGroupName, String managedNetworkName) { + return getByResourceGroupAsync(resourceGroupName, managedNetworkName).block(); + } + + /** + * The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed + * Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String managedNetworkName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, managedNetworkName, context).block(); + } + + /** + * The Put ManagedNetworks operation creates/updates a Managed Network Resource, specified by resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetwork Parameters supplied to the create/update a Managed Network 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 Managed Network resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedNetworkName, ManagedNetworkInner managedNetwork) { + 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetwork == null) { + return Mono.error(new IllegalArgumentException("Parameter managedNetwork is required and cannot be null.")); + } else { + managedNetwork.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetwork, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The Put ManagedNetworks operation creates/updates a Managed Network Resource, specified by resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetwork Parameters supplied to the create/update a Managed Network 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 Managed Network resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedNetworkName, ManagedNetworkInner managedNetwork, 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (managedNetwork == null) { + return Mono.error(new IllegalArgumentException("Parameter managedNetwork is required and cannot be null.")); + } else { + managedNetwork.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + managedNetwork, + accept, + context); + } + + /** + * The Put ManagedNetworks operation creates/updates a Managed Network Resource, specified by resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetwork Parameters supplied to the create/update a Managed Network 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 Managed Network resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String managedNetworkName, ManagedNetworkInner managedNetwork) { + return createOrUpdateWithResponseAsync(resourceGroupName, managedNetworkName, managedNetwork) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The Put ManagedNetworks operation creates/updates a Managed Network Resource, specified by resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetwork Parameters supplied to the create/update a Managed Network 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 Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedNetworkInner createOrUpdate( + String resourceGroupName, String managedNetworkName, ManagedNetworkInner managedNetwork) { + return createOrUpdateAsync(resourceGroupName, managedNetworkName, managedNetwork).block(); + } + + /** + * The Put ManagedNetworks operation creates/updates a Managed Network Resource, specified by resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetwork Parameters supplied to the create/update a Managed Network 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 Managed Network resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String managedNetworkName, ManagedNetworkInner managedNetwork, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, managedNetworkName, managedNetwork, context).block(); + } + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 managedNetworkName) { + 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 managedNetworkName, 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + accept, + context); + } + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 managedNetworkName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, managedNetworkName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 managedNetworkName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, managedNetworkName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 managedNetworkName) { + return beginDeleteAsync(resourceGroupName, managedNetworkName).getSyncPoller(); + } + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 managedNetworkName, Context context) { + return beginDeleteAsync(resourceGroupName, managedNetworkName, context).getSyncPoller(); + } + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedNetworkName) { + return beginDeleteAsync(resourceGroupName, managedNetworkName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 managedNetworkName, Context context) { + return beginDeleteAsync(resourceGroupName, managedNetworkName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 managedNetworkName) { + deleteAsync(resourceGroupName, managedNetworkName).block(); + } + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 managedNetworkName, Context context) { + deleteAsync(resourceGroupName, managedNetworkName, context).block(); + } + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate 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 (managedNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedNetworkName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + managedNetworkName, + parameters, + accept, + context); + } + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 the Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedNetworkInner> beginUpdateAsync( + String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, managedNetworkName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedNetworkInner.class, + ManagedNetworkInner.class, + this.client.getContext()); + } + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 the Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedNetworkInner> beginUpdateAsync( + String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, managedNetworkName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ManagedNetworkInner.class, ManagedNetworkInner.class, context); + } + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 the Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedNetworkInner> beginUpdate( + String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate parameters) { + return beginUpdateAsync(resourceGroupName, managedNetworkName, parameters).getSyncPoller(); + } + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 the Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedNetworkInner> beginUpdate( + String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, managedNetworkName, parameters, context).getSyncPoller(); + } + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate parameters) { + return beginUpdateAsync(resourceGroupName, managedNetworkName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, managedNetworkName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedNetworkInner update( + String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate parameters) { + return updateAsync(resourceGroupName, managedNetworkName, parameters).block(); + } + + /** + * Updates the specified Managed Network resource tags. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param parameters Parameters supplied to update application gateway tags and/or scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedNetworkInner update( + String resourceGroupName, String managedNetworkName, ManagedNetworkUpdate parameters, Context context) { + return updateAsync(resourceGroupName, managedNetworkName, parameters, context).block(); + } + + /** + * The ListByResourceGroup ManagedNetwork operation retrieves all the Managed Network resources in a resource group + * in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Integer top, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + skiptoken, + 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())); + } + + /** + * The ListByResourceGroup ManagedNetwork operation retrieves all the Managed Network resources in a resource group + * in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Integer top, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + skiptoken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * The ListByResourceGroup ManagedNetwork operation retrieves all the Managed Network resources in a resource group + * in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Integer top, String skiptoken) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top, skiptoken), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * The ListByResourceGroup ManagedNetwork operation retrieves all the Managed Network resources in a resource group + * in a paginated format. + * + * @param resourceGroupName The name of the 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 result of the request to list Managed Network as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final Integer top = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top, skiptoken), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * The ListByResourceGroup ManagedNetwork operation retrieves all the Managed Network resources in a resource group + * in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Integer top, String skiptoken, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top, skiptoken, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * The ListByResourceGroup ManagedNetwork operation retrieves all the Managed Network resources in a resource group + * in a paginated format. + * + * @param resourceGroupName The name of the 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 result of the request to list Managed Network as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final Integer top = null; + final String skiptoken = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top, skiptoken)); + } + + /** + * The ListByResourceGroup ManagedNetwork operation retrieves all the Managed Network resources in a resource group + * in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, String skiptoken, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top, skiptoken, context)); + } + + /** + * The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current + * subscription in a paginated format. + * + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + top, + skiptoken, + 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())); + } + + /** + * The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current + * subscription in a paginated format. + * + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + Integer top, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + top, + skiptoken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current + * subscription in a paginated format. + * + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top, String skiptoken) { + return new PagedFlux<>( + () -> listSinglePageAsync(top, skiptoken), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current + * subscription in a paginated format. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final Integer top = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(top, skiptoken), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current + * subscription in a paginated format. + * + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top, String skiptoken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(top, skiptoken, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current + * subscription in a paginated format. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final Integer top = null; + final String skiptoken = null; + return new PagedIterable<>(listAsync(top, skiptoken)); + } + + /** + * The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current + * subscription in a paginated format. + * + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Integer top, String skiptoken, Context context) { + return new PagedIterable<>(listAsync(top, skiptoken, 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 result of the request to list Managed Network along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 result of the request to list Managed Network along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 result of the request to list Managed Network 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 result of the request to list Managed Network along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworksImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworksImpl.java new file mode 100644 index 0000000000000..c500de01c27cc --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworksImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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.managednetwork.fluent.ManagedNetworksClient; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkInner; +import com.azure.resourcemanager.managednetwork.models.ManagedNetwork; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworks; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagedNetworksImpl implements ManagedNetworks { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedNetworksImpl.class); + + private final ManagedNetworksClient innerClient; + + private final com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager; + + public ManagedNetworksImpl( + ManagedNetworksClient innerClient, + com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedNetwork getByResourceGroup(String resourceGroupName, String managedNetworkName) { + ManagedNetworkInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, managedNetworkName); + if (inner != null) { + return new ManagedNetworkImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String managedNetworkName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, managedNetworkName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedNetworkImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String managedNetworkName) { + this.serviceClient().delete(resourceGroupName, managedNetworkName); + } + + public void delete(String resourceGroupName, String managedNetworkName, Context context) { + this.serviceClient().delete(resourceGroupName, managedNetworkName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ManagedNetworkImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, String skiptoken, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, top, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new ManagedNetworkImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ManagedNetworkImpl(inner1, this.manager())); + } + + public PagedIterable list(Integer top, String skiptoken, Context context) { + PagedIterable inner = this.serviceClient().list(top, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new ManagedNetworkImpl(inner1, this.manager())); + } + + public ManagedNetwork 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 managedNetworkName = Utils.getValueFromIdByName(id, "managedNetworks"); + if (managedNetworkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'managedNetworks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, managedNetworkName, 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 managedNetworkName = Utils.getValueFromIdByName(id, "managedNetworks"); + if (managedNetworkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'managedNetworks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, managedNetworkName, 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 managedNetworkName = Utils.getValueFromIdByName(id, "managedNetworks"); + if (managedNetworkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'managedNetworks'.", id))); + } + this.delete(resourceGroupName, managedNetworkName, 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 managedNetworkName = Utils.getValueFromIdByName(id, "managedNetworks"); + if (managedNetworkName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'managedNetworks'.", id))); + } + this.delete(resourceGroupName, managedNetworkName, context); + } + + private ManagedNetworksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager() { + return this.serviceManager; + } + + public ManagedNetworkImpl define(String name) { + return new ManagedNetworkImpl(name, this.manager()); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationImpl.java new file mode 100644 index 0000000000000..1b8f45a1acc67 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.implementation; + +import com.azure.resourcemanager.managednetwork.fluent.models.OperationInner; +import com.azure.resourcemanager.managednetwork.models.Operation; +import com.azure.resourcemanager.managednetwork.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationsClientImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..f71f9e0d4c06c --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationsClientImpl.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.fluent.OperationsClient; +import com.azure.resourcemanager.managednetwork.fluent.models.OperationInner; +import com.azure.resourcemanager.managednetwork.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final ManagedNetworkManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ManagedNetworkManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedNetworkManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedNetworkManage") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ManagedNetwork/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available MNC operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network operations along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available MNC operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network operations along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available MNC operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available MNC operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available MNC operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available MNC operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 result of the request to list Managed Network operations 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 result of the request to list Managed Network operations 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/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationsImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..72f53b68a1d24 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationsImpl.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.managednetwork.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.fluent.OperationsClient; +import com.azure.resourcemanager.managednetwork.fluent.models.OperationInner; +import com.azure.resourcemanager.managednetwork.models.Operation; +import com.azure.resourcemanager.managednetwork.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentImpl.java new file mode 100644 index 0000000000000..335518f388482 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managednetwork.fluent.models.ScopeAssignmentInner; +import com.azure.resourcemanager.managednetwork.models.ProvisioningState; +import com.azure.resourcemanager.managednetwork.models.ScopeAssignment; + +public final class ScopeAssignmentImpl implements ScopeAssignment, ScopeAssignment.Definition, ScopeAssignment.Update { + private ScopeAssignmentInner innerObject; + + private final com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public String assignedManagedNetwork() { + return this.innerModel().assignedManagedNetwork(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ScopeAssignmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager() { + return this.serviceManager; + } + + private String scope; + + private String scopeAssignmentName; + + public ScopeAssignmentImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public ScopeAssignment create() { + this.innerObject = + serviceManager + .serviceClient() + .getScopeAssignments() + .createOrUpdateWithResponse(scope, scopeAssignmentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ScopeAssignment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getScopeAssignments() + .createOrUpdateWithResponse(scope, scopeAssignmentName, this.innerModel(), context) + .getValue(); + return this; + } + + ScopeAssignmentImpl(String name, com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerObject = new ScopeAssignmentInner(); + this.serviceManager = serviceManager; + this.scopeAssignmentName = name; + } + + public ScopeAssignmentImpl update() { + return this; + } + + public ScopeAssignment apply() { + this.innerObject = + serviceManager + .serviceClient() + .getScopeAssignments() + .createOrUpdateWithResponse(scope, scopeAssignmentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ScopeAssignment apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getScopeAssignments() + .createOrUpdateWithResponse(scope, scopeAssignmentName, this.innerModel(), context) + .getValue(); + return this; + } + + ScopeAssignmentImpl( + ScopeAssignmentInner innerObject, + com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.scope = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}", + "scope"); + this.scopeAssignmentName = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}", + "scopeAssignmentName"); + } + + public ScopeAssignment refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getScopeAssignments() + .getWithResponse(scope, scopeAssignmentName, Context.NONE) + .getValue(); + return this; + } + + public ScopeAssignment refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getScopeAssignments() + .getWithResponse(scope, scopeAssignmentName, context) + .getValue(); + return this; + } + + public ScopeAssignmentImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ScopeAssignmentImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ScopeAssignmentImpl withAssignedManagedNetwork(String assignedManagedNetwork) { + this.innerModel().withAssignedManagedNetwork(assignedManagedNetwork); + return this; + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentsClientImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentsClientImpl.java new file mode 100644 index 0000000000000..91f96745ec0fc --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentsClientImpl.java @@ -0,0 +1,741 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.fluent.ScopeAssignmentsClient; +import com.azure.resourcemanager.managednetwork.fluent.models.ScopeAssignmentInner; +import com.azure.resourcemanager.managednetwork.models.ScopeAssignmentListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ScopeAssignmentsClient. */ +public final class ScopeAssignmentsClientImpl implements ScopeAssignmentsClient { + private final ClientLogger logger = new ClientLogger(ScopeAssignmentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ScopeAssignmentsService service; + + /** The service client containing this operation class. */ + private final ManagedNetworkManagementClientImpl client; + + /** + * Initializes an instance of ScopeAssignmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ScopeAssignmentsClientImpl(ManagedNetworkManagementClientImpl client) { + this.service = + RestProxy.create(ScopeAssignmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedNetworkManagementClientScopeAssignments to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedNetworkManage") + private interface ScopeAssignmentsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("scopeAssignmentName") String scopeAssignmentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("scopeAssignmentName") String scopeAssignmentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScopeAssignmentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete("/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("scopeAssignmentName") String scopeAssignmentName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @param scopeAssignmentName The name of the scope assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope assignment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String scopeAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (scopeAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scopeAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + scope, + scopeAssignmentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @param scopeAssignmentName The name of the scope assignment to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope assignment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String scopeAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (scopeAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scopeAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), scope, scopeAssignmentName, this.client.getApiVersion(), accept, context); + } + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @param scopeAssignmentName The name of the scope assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope assignment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String scopeAssignmentName) { + return getWithResponseAsync(scope, scopeAssignmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @param scopeAssignmentName The name of the scope assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScopeAssignmentInner get(String scope, String scopeAssignmentName) { + return getAsync(scope, scopeAssignmentName).block(); + } + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @param scopeAssignmentName The name of the scope assignment to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope assignment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, String scopeAssignmentName, Context context) { + return getWithResponseAsync(scope, scopeAssignmentName, context).block(); + } + + /** + * Creates a scope assignment. + * + * @param scope The base resource of the scope assignment to create. The scope can be any REST resource instance. + * For example, use 'subscriptions/{subscription-id}' for a subscription, + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param scopeAssignmentName The name of the scope assignment to create. + * @param parameters Parameters supplied to the specify which Managed Network this scope is being assigned. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String scope, String scopeAssignmentName, ScopeAssignmentInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (scopeAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scopeAssignmentName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + scope, + scopeAssignmentName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a scope assignment. + * + * @param scope The base resource of the scope assignment to create. The scope can be any REST resource instance. + * For example, use 'subscriptions/{subscription-id}' for a subscription, + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param scopeAssignmentName The name of the scope assignment to create. + * @param parameters Parameters supplied to the specify which Managed Network this scope is being assigned. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String scope, String scopeAssignmentName, ScopeAssignmentInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (scopeAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scopeAssignmentName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + scope, + scopeAssignmentName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Creates a scope assignment. + * + * @param scope The base resource of the scope assignment to create. The scope can be any REST resource instance. + * For example, use 'subscriptions/{subscription-id}' for a subscription, + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param scopeAssignmentName The name of the scope assignment to create. + * @param parameters Parameters supplied to the specify which Managed Network this scope is being assigned. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String scope, String scopeAssignmentName, ScopeAssignmentInner parameters) { + return createOrUpdateWithResponseAsync(scope, scopeAssignmentName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a scope assignment. + * + * @param scope The base resource of the scope assignment to create. The scope can be any REST resource instance. + * For example, use 'subscriptions/{subscription-id}' for a subscription, + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param scopeAssignmentName The name of the scope assignment to create. + * @param parameters Parameters supplied to the specify which Managed Network this scope is being assigned. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScopeAssignmentInner createOrUpdate( + String scope, String scopeAssignmentName, ScopeAssignmentInner parameters) { + return createOrUpdateAsync(scope, scopeAssignmentName, parameters).block(); + } + + /** + * Creates a scope assignment. + * + * @param scope The base resource of the scope assignment to create. The scope can be any REST resource instance. + * For example, use 'subscriptions/{subscription-id}' for a subscription, + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param scopeAssignmentName The name of the scope assignment to create. + * @param parameters Parameters supplied to the specify which Managed Network this scope is being assigned. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String scope, String scopeAssignmentName, ScopeAssignmentInner parameters, Context context) { + return createOrUpdateWithResponseAsync(scope, scopeAssignmentName, parameters, context).block(); + } + + /** + * Deletes a scope assignment. + * + * @param scope The scope of the scope assignment to delete. + * @param scopeAssignmentName The name of the scope assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope, String scopeAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (scopeAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scopeAssignmentName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + scope, + scopeAssignmentName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a scope assignment. + * + * @param scope The scope of the scope assignment to delete. + * @param scopeAssignmentName The name of the scope assignment to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope, String scopeAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (scopeAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scopeAssignmentName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .delete(this.client.getEndpoint(), scope, scopeAssignmentName, this.client.getApiVersion(), context); + } + + /** + * Deletes a scope assignment. + * + * @param scope The scope of the scope assignment to delete. + * @param scopeAssignmentName The name of the scope assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 scope, String scopeAssignmentName) { + return deleteWithResponseAsync(scope, scopeAssignmentName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a scope assignment. + * + * @param scope The scope of the scope assignment to delete. + * @param scopeAssignmentName The name of the scope assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 scope, String scopeAssignmentName) { + deleteAsync(scope, scopeAssignmentName).block(); + } + + /** + * Deletes a scope assignment. + * + * @param scope The scope of the scope assignment to delete. + * @param scopeAssignmentName The name of the scope assignment to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope, String scopeAssignmentName, Context context) { + return deleteWithResponseAsync(scope, scopeAssignmentName, context).block(); + } + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope assignment along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), scope, 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())); + } + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope assignment along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope assignment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope assignment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope assignment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 scope assignment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Context context) { + return new PagedIterable<>(listAsync(scope, 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 result of the request to list ScopeAssignment 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 result of the request to list ScopeAssignment 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/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentsImpl.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentsImpl.java new file mode 100644 index 0000000000000..eccfd88f6cbe6 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentsImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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.managednetwork.fluent.ScopeAssignmentsClient; +import com.azure.resourcemanager.managednetwork.fluent.models.ScopeAssignmentInner; +import com.azure.resourcemanager.managednetwork.models.ScopeAssignment; +import com.azure.resourcemanager.managednetwork.models.ScopeAssignments; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ScopeAssignmentsImpl implements ScopeAssignments { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScopeAssignmentsImpl.class); + + private final ScopeAssignmentsClient innerClient; + + private final com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager; + + public ScopeAssignmentsImpl( + ScopeAssignmentsClient innerClient, + com.azure.resourcemanager.managednetwork.ManagedNetworkManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ScopeAssignment get(String scope, String scopeAssignmentName) { + ScopeAssignmentInner inner = this.serviceClient().get(scope, scopeAssignmentName); + if (inner != null) { + return new ScopeAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String scope, String scopeAssignmentName, Context context) { + Response inner = + this.serviceClient().getWithResponse(scope, scopeAssignmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScopeAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String scope, String scopeAssignmentName) { + this.serviceClient().delete(scope, scopeAssignmentName); + } + + public Response deleteWithResponse(String scope, String scopeAssignmentName, Context context) { + return this.serviceClient().deleteWithResponse(scope, scopeAssignmentName, context); + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return Utils.mapPage(inner, inner1 -> new ScopeAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return Utils.mapPage(inner, inner1 -> new ScopeAssignmentImpl(inner1, this.manager())); + } + + public ScopeAssignment getById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String scopeAssignmentName = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}", + "scopeAssignmentName"); + if (scopeAssignmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'scopeAssignments'.", id))); + } + return this.getWithResponse(scope, scopeAssignmentName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String scopeAssignmentName = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}", + "scopeAssignmentName"); + if (scopeAssignmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'scopeAssignments'.", id))); + } + return this.getWithResponse(scope, scopeAssignmentName, context); + } + + public void deleteById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String scopeAssignmentName = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}", + "scopeAssignmentName"); + if (scopeAssignmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'scopeAssignments'.", id))); + } + this.deleteWithResponse(scope, scopeAssignmentName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}", "scope"); + if (scope == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String scopeAssignmentName = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}", + "scopeAssignmentName"); + if (scopeAssignmentName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'scopeAssignments'.", id))); + } + return this.deleteWithResponse(scope, scopeAssignmentName, context); + } + + private ScopeAssignmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager() { + return this.serviceManager; + } + + public ScopeAssignmentImpl define(String name) { + return new ScopeAssignmentImpl(name, this.manager()); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/Utils.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/Utils.java new file mode 100644 index 0000000000000..49411cd528c3b --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/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.managednetwork.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/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/package-info.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/package-info.java new file mode 100644 index 0000000000000..ce40cae1f3f93 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/package-info.java @@ -0,0 +1,10 @@ +// 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 ManagedNetworkManagementClient. The Microsoft Azure Managed Network + * management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to + * programmatically view, control, change, and monitor your entire Azure network centrally and with ease. + */ +package com.azure.resourcemanager.managednetwork.implementation; diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ConnectivityCollection.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ConnectivityCollection.java new file mode 100644 index 0000000000000..97fbf4b831a48 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ConnectivityCollection.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkGroupInner; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkPeeringPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The collection of Connectivity related groups and policies within the Managed Network. */ +@Immutable +public final class ConnectivityCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConnectivityCollection.class); + + /* + * The collection of connectivity related Managed Network Groups within the + * Managed Network + */ + @JsonProperty(value = "groups", access = JsonProperty.Access.WRITE_ONLY) + private List groups; + + /* + * The collection of Managed Network Peering Policies within the Managed + * Network + */ + @JsonProperty(value = "peerings", access = JsonProperty.Access.WRITE_ONLY) + private List peerings; + + /** + * Get the groups property: The collection of connectivity related Managed Network Groups within the Managed + * Network. + * + * @return the groups value. + */ + public List groups() { + return this.groups; + } + + /** + * Get the peerings property: The collection of Managed Network Peering Policies within the Managed Network. + * + * @return the peerings value. + */ + public List peerings() { + return this.peerings; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (groups() != null) { + groups().forEach(e -> e.validate()); + } + if (peerings() != null) { + peerings().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/HubAndSpokePeeringPolicyProperties.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/HubAndSpokePeeringPolicyProperties.java new file mode 100644 index 0000000000000..17c73a51d930a --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/HubAndSpokePeeringPolicyProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.List; + +/** Properties of a Hub and Spoke Peering Policy. */ +@Fluent +public final class HubAndSpokePeeringPolicyProperties extends ManagedNetworkPeeringPolicyProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HubAndSpokePeeringPolicyProperties.class); + + /** {@inheritDoc} */ + @Override + public HubAndSpokePeeringPolicyProperties withType(Type type) { + super.withType(type); + return this; + } + + /** {@inheritDoc} */ + @Override + public HubAndSpokePeeringPolicyProperties withHub(ResourceId hub) { + super.withHub(hub); + return this; + } + + /** {@inheritDoc} */ + @Override + public HubAndSpokePeeringPolicyProperties withSpokes(List spokes) { + super.withSpokes(spokes); + return this; + } + + /** {@inheritDoc} */ + @Override + public HubAndSpokePeeringPolicyProperties withMesh(List mesh) { + super.withMesh(mesh); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Kind.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Kind.java new file mode 100644 index 0000000000000..2313b8a089548 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Kind.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Kind. */ +public final class Kind extends ExpandableStringEnum { + /** Static value Connectivity for Kind. */ + public static final Kind CONNECTIVITY = fromString("Connectivity"); + + /** + * Creates or finds a Kind from its string representation. + * + * @param name a name to look for. + * @return the corresponding Kind. + */ + @JsonCreator + public static Kind fromString(String name) { + return fromString(name, Kind.class); + } + + /** @return known Kind values. */ + public static Collection values() { + return values(Kind.class); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetwork.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetwork.java new file mode 100644 index 0000000000000..fcf90cb1b1e9a --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetwork.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkInner; +import java.util.Map; + +/** An immutable client-side representation of ManagedNetwork. */ +public interface ManagedNetwork { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the scope property: The collection of management groups, subscriptions, virtual networks, and subnets by the + * Managed Network. This is a read-only property that is reflective of all ScopeAssignments for this Managed + * Network. + * + * @return the scope value. + */ + Scope scope(); + + /** + * Gets the connectivity property: The collection of groups and policies concerned with connectivity. + * + * @return the connectivity value. + */ + ConnectivityCollection connectivity(); + + /** + * Gets the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkInner object. + * + * @return the inner object. + */ + ManagedNetworkInner innerModel(); + + /** The entirety of the ManagedNetwork definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ManagedNetwork definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedNetwork definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ManagedNetwork definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the ManagedNetwork definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ManagedNetwork 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.WithScope { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedNetwork create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedNetwork create(Context context); + } + /** The stage of the ManagedNetwork 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 ManagedNetwork definition allowing to specify scope. */ + interface WithScope { + /** + * Specifies the scope property: The collection of management groups, subscriptions, virtual networks, and + * subnets by the Managed Network. This is a read-only property that is reflective of all ScopeAssignments + * for this Managed Network. + * + * @param scope The collection of management groups, subscriptions, virtual networks, and subnets by the + * Managed Network. This is a read-only property that is reflective of all ScopeAssignments for this + * Managed Network. + * @return the next definition stage. + */ + WithCreate withScope(Scope scope); + } + } + /** + * Begins update for the ManagedNetwork resource. + * + * @return the stage of resource update. + */ + ManagedNetwork.Update update(); + + /** The template for ManagedNetwork update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedNetwork apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedNetwork apply(Context context); + } + /** The ManagedNetwork update stages. */ + interface UpdateStages { + /** The stage of the ManagedNetwork update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedNetwork refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedNetwork refresh(Context context); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroup.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroup.java new file mode 100644 index 0000000000000..8fb07dc4ebb54 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroup.java @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkGroupInner; +import java.util.List; + +/** An immutable client-side representation of ManagedNetworkGroup. */ +public interface ManagedNetworkGroup { + /** + * 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 kind property: Responsibility role under which this Managed Network Group will be created. + * + * @return the kind value. + */ + Kind kind(); + + /** + * Gets the managementGroups property: The collection of management groups covered by the Managed Network. + * + * @return the managementGroups value. + */ + List managementGroups(); + + /** + * Gets the subscriptions property: The collection of subscriptions covered by the Managed Network. + * + * @return the subscriptions value. + */ + List subscriptions(); + + /** + * Gets the virtualNetworks property: The collection of virtual nets covered by the Managed Network. + * + * @return the virtualNetworks value. + */ + List virtualNetworks(); + + /** + * Gets the subnets property: The collection of subnets covered by the Managed Network. + * + * @return the subnets value. + */ + List subnets(); + + /** + * Gets the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the inner com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkGroupInner object. + * + * @return the inner object. + */ + ManagedNetworkGroupInner innerModel(); + + /** The entirety of the ManagedNetworkGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedNetworkGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedNetworkGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedNetworkGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedNetworkName. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @return the next definition stage. + */ + WithCreate withExistingManagedNetwork(String resourceGroupName, String managedNetworkName); + } + /** + * The stage of the ManagedNetworkGroup 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.WithKind, + DefinitionStages.WithManagementGroups, + DefinitionStages.WithSubscriptions, + DefinitionStages.WithVirtualNetworks, + DefinitionStages.WithSubnets { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedNetworkGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedNetworkGroup create(Context context); + } + /** The stage of the ManagedNetworkGroup definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: Responsibility role under which this Managed Network Group will be created. + * + * @param kind Responsibility role under which this Managed Network Group will be created. + * @return the next definition stage. + */ + WithCreate withKind(Kind kind); + } + /** The stage of the ManagedNetworkGroup definition allowing to specify managementGroups. */ + interface WithManagementGroups { + /** + * Specifies the managementGroups property: The collection of management groups covered by the Managed + * Network. + * + * @param managementGroups The collection of management groups covered by the Managed Network. + * @return the next definition stage. + */ + WithCreate withManagementGroups(List managementGroups); + } + /** The stage of the ManagedNetworkGroup definition allowing to specify subscriptions. */ + interface WithSubscriptions { + /** + * Specifies the subscriptions property: The collection of subscriptions covered by the Managed Network. + * + * @param subscriptions The collection of subscriptions covered by the Managed Network. + * @return the next definition stage. + */ + WithCreate withSubscriptions(List subscriptions); + } + /** The stage of the ManagedNetworkGroup definition allowing to specify virtualNetworks. */ + interface WithVirtualNetworks { + /** + * Specifies the virtualNetworks property: The collection of virtual nets covered by the Managed Network. + * + * @param virtualNetworks The collection of virtual nets covered by the Managed Network. + * @return the next definition stage. + */ + WithCreate withVirtualNetworks(List virtualNetworks); + } + /** The stage of the ManagedNetworkGroup definition allowing to specify subnets. */ + interface WithSubnets { + /** + * Specifies the subnets property: The collection of subnets covered by the Managed Network. + * + * @param subnets The collection of subnets covered by the Managed Network. + * @return the next definition stage. + */ + WithCreate withSubnets(List subnets); + } + } + /** + * Begins update for the ManagedNetworkGroup resource. + * + * @return the stage of resource update. + */ + ManagedNetworkGroup.Update update(); + + /** The template for ManagedNetworkGroup update. */ + interface Update + extends UpdateStages.WithKind, + UpdateStages.WithManagementGroups, + UpdateStages.WithSubscriptions, + UpdateStages.WithVirtualNetworks, + UpdateStages.WithSubnets { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedNetworkGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedNetworkGroup apply(Context context); + } + /** The ManagedNetworkGroup update stages. */ + interface UpdateStages { + /** The stage of the ManagedNetworkGroup update allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: Responsibility role under which this Managed Network Group will be created. + * + * @param kind Responsibility role under which this Managed Network Group will be created. + * @return the next definition stage. + */ + Update withKind(Kind kind); + } + /** The stage of the ManagedNetworkGroup update allowing to specify managementGroups. */ + interface WithManagementGroups { + /** + * Specifies the managementGroups property: The collection of management groups covered by the Managed + * Network. + * + * @param managementGroups The collection of management groups covered by the Managed Network. + * @return the next definition stage. + */ + Update withManagementGroups(List managementGroups); + } + /** The stage of the ManagedNetworkGroup update allowing to specify subscriptions. */ + interface WithSubscriptions { + /** + * Specifies the subscriptions property: The collection of subscriptions covered by the Managed Network. + * + * @param subscriptions The collection of subscriptions covered by the Managed Network. + * @return the next definition stage. + */ + Update withSubscriptions(List subscriptions); + } + /** The stage of the ManagedNetworkGroup update allowing to specify virtualNetworks. */ + interface WithVirtualNetworks { + /** + * Specifies the virtualNetworks property: The collection of virtual nets covered by the Managed Network. + * + * @param virtualNetworks The collection of virtual nets covered by the Managed Network. + * @return the next definition stage. + */ + Update withVirtualNetworks(List virtualNetworks); + } + /** The stage of the ManagedNetworkGroup update allowing to specify subnets. */ + interface WithSubnets { + /** + * Specifies the subnets property: The collection of subnets covered by the Managed Network. + * + * @param subnets The collection of subnets covered by the Managed Network. + * @return the next definition stage. + */ + Update withSubnets(List subnets); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedNetworkGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedNetworkGroup refresh(Context context); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroupListResult.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroupListResult.java new file mode 100644 index 0000000000000..d82bac7a4366e --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroupListResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list Managed Network Groups. It contains a list of groups and a URL link to get the next set + * of results. + */ +@Fluent +public final class ManagedNetworkGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedNetworkGroupListResult.class); + + /* + * Gets a page of ManagedNetworkGroup + */ + @JsonProperty(value = "value") + private List value; + + /* + * Gets the URL to get the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Gets a page of ManagedNetworkGroup. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets a page of ManagedNetworkGroup. + * + * @param value the value value to set. + * @return the ManagedNetworkGroupListResult object itself. + */ + public ManagedNetworkGroupListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets the URL to get the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets the URL to get the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ManagedNetworkGroupListResult object itself. + */ + public ManagedNetworkGroupListResult 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/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroups.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroups.java new file mode 100644 index 0000000000000..88cab361e01bc --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroups.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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 ManagedNetworkGroups. */ +public interface ManagedNetworkGroups { + /** + * The Get ManagedNetworkGroups operation gets a Managed Network Group specified by the resource group, Managed + * Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the Managed Network Group resource. + */ + ManagedNetworkGroup get(String resourceGroupName, String managedNetworkName, String managedNetworkGroupName); + + /** + * The Get ManagedNetworkGroups operation gets a Managed Network Group specified by the resource group, Managed + * Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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 the Managed Network Group resource along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, Context context); + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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. + */ + void delete(String resourceGroupName, String managedNetworkName, String managedNetworkGroupName); + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkGroupName The name of the Managed Network 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. + */ + void delete(String resourceGroupName, String managedNetworkName, String managedNetworkGroupName, Context context); + + /** + * The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the Managed Network Groups in a specified + * Managed Networks in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedNetwork(String resourceGroupName, String managedNetworkName); + + /** + * The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the Managed Network Groups in a specified + * Managed Networks in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 result of the request to list Managed Network Groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken, Context context); + + /** + * The Get ManagedNetworkGroups operation gets a Managed Network Group specified by the resource group, Managed + * Network name, and group 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 the Managed Network Group resource along with {@link Response}. + */ + ManagedNetworkGroup getById(String id); + + /** + * The Get ManagedNetworkGroups operation gets a Managed Network Group specified by the resource group, Managed + * Network name, and group name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Group resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * The Delete ManagedNetworkGroups operation deletes a Managed Network Group specified by the resource group, + * Managed Network name, and group 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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedNetworkGroup resource. + * + * @param name resource name. + * @return the first stage of the new ManagedNetworkGroup definition. + */ + ManagedNetworkGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkListResult.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkListResult.java new file mode 100644 index 0000000000000..28268d0cd2965 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkListResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list Managed Network. It contains a list of Managed Networks and a URL link to get the next + * set of results. + */ +@Fluent +public final class ManagedNetworkListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedNetworkListResult.class); + + /* + * Gets a page of ManagedNetworks + */ + @JsonProperty(value = "value") + private List value; + + /* + * Gets the URL to get the next page of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Gets a page of ManagedNetworks. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets a page of ManagedNetworks. + * + * @param value the value value to set. + * @return the ManagedNetworkListResult object itself. + */ + public ManagedNetworkListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets the URL to get the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets the URL to get the next page of results. + * + * @param nextLink the nextLink value to set. + * @return the ManagedNetworkListResult object itself. + */ + public ManagedNetworkListResult 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/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicies.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicies.java new file mode 100644 index 0000000000000..668935ae19542 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicies.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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 ManagedNetworkPeeringPolicies. */ +public interface ManagedNetworkPeeringPolicies { + /** + * The Get ManagedNetworkPeeringPolicies operation gets a Managed Network Peering Policy resource, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource. + */ + ManagedNetworkPeeringPolicy get( + String resourceGroupName, String managedNetworkName, String managedNetworkPeeringPolicyName); + + /** + * The Get ManagedNetworkPeeringPolicies operation gets a Managed Network Peering Policy resource, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @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 Managed Network Peering Policy resource along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedNetworkName, String managedNetworkPeeringPolicyName, Context context); + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 managedNetworkName, String managedNetworkPeeringPolicyName); + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param managedNetworkPeeringPolicyName The name of the Managed Network Peering Policy. + * @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 managedNetworkName, String managedNetworkPeeringPolicyName, Context context); + + /** + * The ListByManagedNetwork PeeringPolicies operation retrieves all the Managed Network Peering Policies in a + * specified Managed Network, in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network Peering Policies as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName); + + /** + * The ListByManagedNetwork PeeringPolicies operation retrieves all the Managed Network Peering Policies in a + * specified Managed Network, in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 result of the request to list Managed Network Peering Policies as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByManagedNetwork( + String resourceGroupName, String managedNetworkName, Integer top, String skiptoken, Context context); + + /** + * The Get ManagedNetworkPeeringPolicies operation gets a Managed Network Peering Policy resource, specified by the + * resource group, Managed Network name, and peering policy 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 the Managed Network Peering Policy resource along with {@link Response}. + */ + ManagedNetworkPeeringPolicy getById(String id); + + /** + * The Get ManagedNetworkPeeringPolicies operation gets a Managed Network Peering Policy resource, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network Peering Policy resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * The Delete ManagedNetworkPeeringPolicies operation deletes a Managed Network Peering Policy, specified by the + * resource group, Managed Network name, and peering policy 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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedNetworkPeeringPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ManagedNetworkPeeringPolicy definition. + */ + ManagedNetworkPeeringPolicy.DefinitionStages.Blank define(String name); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicy.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicy.java new file mode 100644 index 0000000000000..e6d6f108f3a67 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicy.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkPeeringPolicyInner; + +/** An immutable client-side representation of ManagedNetworkPeeringPolicy. */ +public interface ManagedNetworkPeeringPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Gets or sets the properties of a Managed Network Policy. + * + * @return the properties value. + */ + ManagedNetworkPeeringPolicyProperties properties(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkPeeringPolicyInner object. + * + * @return the inner object. + */ + ManagedNetworkPeeringPolicyInner innerModel(); + + /** The entirety of the ManagedNetworkPeeringPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedNetworkPeeringPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedNetworkPeeringPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedNetworkPeeringPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedNetworkName. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @return the next definition stage. + */ + WithCreate withExistingManagedNetwork(String resourceGroupName, String managedNetworkName); + } + /** + * The stage of the ManagedNetworkPeeringPolicy 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.WithLocation, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedNetworkPeeringPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedNetworkPeeringPolicy create(Context context); + } + /** The stage of the ManagedNetworkPeeringPolicy definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** The stage of the ManagedNetworkPeeringPolicy definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Gets or sets the properties of a Managed Network Policy. + * + * @param properties Gets or sets the properties of a Managed Network Policy. + * @return the next definition stage. + */ + WithCreate withProperties(ManagedNetworkPeeringPolicyProperties properties); + } + } + /** + * Begins update for the ManagedNetworkPeeringPolicy resource. + * + * @return the stage of resource update. + */ + ManagedNetworkPeeringPolicy.Update update(); + + /** The template for ManagedNetworkPeeringPolicy update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedNetworkPeeringPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedNetworkPeeringPolicy apply(Context context); + } + /** The ManagedNetworkPeeringPolicy update stages. */ + interface UpdateStages { + /** The stage of the ManagedNetworkPeeringPolicy update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Gets or sets the properties of a Managed Network Policy. + * + * @param properties Gets or sets the properties of a Managed Network Policy. + * @return the next definition stage. + */ + Update withProperties(ManagedNetworkPeeringPolicyProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedNetworkPeeringPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedNetworkPeeringPolicy refresh(Context context); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicyListResult.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicyListResult.java new file mode 100644 index 0000000000000..2f0c7949cc3a4 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicyListResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkPeeringPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list Managed Network Peering Policies. It contains a list of policies and a URL link to get + * the next set of results. + */ +@Fluent +public final class ManagedNetworkPeeringPolicyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedNetworkPeeringPolicyListResult.class); + + /* + * Gets a page of Peering Policies + */ + @JsonProperty(value = "value") + private List value; + + /* + * Gets the URL to get the next page of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Gets a page of Peering Policies. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets a page of Peering Policies. + * + * @param value the value value to set. + * @return the ManagedNetworkPeeringPolicyListResult object itself. + */ + public ManagedNetworkPeeringPolicyListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets the URL to get the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets the URL to get the next page of results. + * + * @param nextLink the nextLink value to set. + * @return the ManagedNetworkPeeringPolicyListResult object itself. + */ + public ManagedNetworkPeeringPolicyListResult 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/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicyProperties.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicyProperties.java new file mode 100644 index 0000000000000..c672f3d325046 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicyProperties.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a Managed Network Peering Policy. */ +@Fluent +public class ManagedNetworkPeeringPolicyProperties extends ResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedNetworkPeeringPolicyProperties.class); + + /* + * Gets or sets the connectivity type of a network structure policy + */ + @JsonProperty(value = "type", required = true) + private Type type; + + /* + * Gets or sets the hub virtual network ID + */ + @JsonProperty(value = "hub") + private ResourceId hub; + + /* + * Gets or sets the spokes group IDs + */ + @JsonProperty(value = "spokes") + private List spokes; + + /* + * Gets or sets the mesh group IDs + */ + @JsonProperty(value = "mesh") + private List mesh; + + /** + * Get the type property: Gets or sets the connectivity type of a network structure policy. + * + * @return the type value. + */ + public Type type() { + return this.type; + } + + /** + * Set the type property: Gets or sets the connectivity type of a network structure policy. + * + * @param type the type value to set. + * @return the ManagedNetworkPeeringPolicyProperties object itself. + */ + public ManagedNetworkPeeringPolicyProperties withType(Type type) { + this.type = type; + return this; + } + + /** + * Get the hub property: Gets or sets the hub virtual network ID. + * + * @return the hub value. + */ + public ResourceId hub() { + return this.hub; + } + + /** + * Set the hub property: Gets or sets the hub virtual network ID. + * + * @param hub the hub value to set. + * @return the ManagedNetworkPeeringPolicyProperties object itself. + */ + public ManagedNetworkPeeringPolicyProperties withHub(ResourceId hub) { + this.hub = hub; + return this; + } + + /** + * Get the spokes property: Gets or sets the spokes group IDs. + * + * @return the spokes value. + */ + public List spokes() { + return this.spokes; + } + + /** + * Set the spokes property: Gets or sets the spokes group IDs. + * + * @param spokes the spokes value to set. + * @return the ManagedNetworkPeeringPolicyProperties object itself. + */ + public ManagedNetworkPeeringPolicyProperties withSpokes(List spokes) { + this.spokes = spokes; + return this; + } + + /** + * Get the mesh property: Gets or sets the mesh group IDs. + * + * @return the mesh value. + */ + public List mesh() { + return this.mesh; + } + + /** + * Set the mesh property: Gets or sets the mesh group IDs. + * + * @param mesh the mesh value to set. + * @return the ManagedNetworkPeeringPolicyProperties object itself. + */ + public ManagedNetworkPeeringPolicyProperties withMesh(List mesh) { + this.mesh = mesh; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model ManagedNetworkPeeringPolicyProperties")); + } + if (hub() != null) { + hub().validate(); + } + if (spokes() != null) { + spokes().forEach(e -> e.validate()); + } + if (mesh() != null) { + mesh().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkUpdate.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkUpdate.java new file mode 100644 index 0000000000000..1313fc991a821 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkUpdate.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.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Update Tags of Managed Network. */ +@Fluent +public final class ManagedNetworkUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedNetworkUpdate.class); + + /* + * 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 ManagedNetworkUpdate object itself. + */ + public ManagedNetworkUpdate 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/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworks.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworks.java new file mode 100644 index 0000000000000..7748d5c926f8b --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworks.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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 ManagedNetworks. */ +public interface ManagedNetworks { + /** + * The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed + * Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource. + */ + ManagedNetwork getByResourceGroup(String resourceGroupName, String managedNetworkName); + + /** + * The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed + * Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @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 Managed Network resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String managedNetworkName, Context context); + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 managedNetworkName); + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param resourceGroupName The name of the resource group. + * @param managedNetworkName The name of the Managed Network. + * @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 managedNetworkName, Context context); + + /** + * The ListByResourceGroup ManagedNetwork operation retrieves all the Managed Network resources in a resource group + * in a paginated format. + * + * @param resourceGroupName The name of the 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 result of the request to list Managed Network as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * The ListByResourceGroup ManagedNetwork operation retrieves all the Managed Network resources in a resource group + * in a paginated format. + * + * @param resourceGroupName The name of the resource group. + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 result of the request to list Managed Network as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, String skiptoken, Context context); + + /** + * The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current + * subscription in a paginated format. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current + * subscription in a paginated format. + * + * @param top May be used to limit the number of results in a page for list queries. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 result of the request to list Managed Network as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Integer top, String skiptoken, Context context); + + /** + * The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed + * Network 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 the Managed Network resource along with {@link Response}. + */ + ManagedNetwork getById(String id); + + /** + * The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed + * Network name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Network resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * The Delete ManagedNetworks operation deletes a Managed Network Resource, specified by the resource group and + * Managed Network 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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedNetwork resource. + * + * @param name resource name. + * @return the first stage of the new ManagedNetwork definition. + */ + ManagedNetwork.DefinitionStages.Blank define(String name); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/MeshPeeringPolicyProperties.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/MeshPeeringPolicyProperties.java new file mode 100644 index 0000000000000..fe7d3354ac587 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/MeshPeeringPolicyProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.List; + +/** Properties of a Mesh Peering Policy. */ +@Fluent +public final class MeshPeeringPolicyProperties extends ManagedNetworkPeeringPolicyProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MeshPeeringPolicyProperties.class); + + /** {@inheritDoc} */ + @Override + public MeshPeeringPolicyProperties withType(Type type) { + super.withType(type); + return this; + } + + /** {@inheritDoc} */ + @Override + public MeshPeeringPolicyProperties withHub(ResourceId hub) { + super.withHub(hub); + return this; + } + + /** {@inheritDoc} */ + @Override + public MeshPeeringPolicyProperties withSpokes(List spokes) { + super.withSpokes(spokes); + return this; + } + + /** {@inheritDoc} */ + @Override + public MeshPeeringPolicyProperties withMesh(List mesh) { + super.withMesh(mesh); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Operation.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Operation.java new file mode 100644 index 0000000000000..fad70a5197100 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Operation.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.resourcemanager.managednetwork.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.managednetwork.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/OperationDisplay.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/OperationDisplay.java new file mode 100644 index 0000000000000..c7948633b7ba1 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/OperationDisplay.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Service provider: Microsoft.ManagedNetwork + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Get the provider property: Service provider: Microsoft.ManagedNetwork. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider: Microsoft.ManagedNetwork. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Operation type: Read, write, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation type: Read, write, delete, etc. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/OperationListResult.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/OperationListResult.java new file mode 100644 index 0000000000000..6bccdb7f7d6c1 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/OperationListResult.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list Managed Network operations. It contains a list of operations and a URL link to get the + * next set of results. + */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of Resource Provider operations supported by the Managed Network + * resource provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of Resource Provider operations supported by the Managed Network resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Resource Provider operations supported by the Managed Network resource provider. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult 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/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Operations.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Operations.java new file mode 100644 index 0000000000000..f3bc95a25ec8b --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Operations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available MNC operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network operations as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all of the available MNC operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Managed Network operations as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ProvisioningState.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ProvisioningState.java new file mode 100644 index 0000000000000..e98ccbd75fbee --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ProvisioningState.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ResourceId.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ResourceId.java new file mode 100644 index 0000000000000..c11472789976b --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ResourceId.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Generic pointer to a resource. */ +@Fluent +public final class ResourceId { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceId.class); + + /* + * Resource Id + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: Resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource Id. + * + * @param id the id value to set. + * @return the ResourceId object itself. + */ + public ResourceId 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/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ResourceProperties.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ResourceProperties.java new file mode 100644 index 0000000000000..aec2afad2804c --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ResourceProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Base for resource properties. */ +@Immutable +public class ResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProperties.class); + + /* + * Provisioning state of the ManagedNetwork resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * A unique read-only string that changes whenever the resource is updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Scope.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Scope.java new file mode 100644 index 0000000000000..e4d94ff744101 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Scope.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Scope of a Managed Network. */ +@Fluent +public final class Scope { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Scope.class); + + /* + * The collection of management groups covered by the Managed Network + */ + @JsonProperty(value = "managementGroups") + private List managementGroups; + + /* + * The collection of subscriptions covered by the Managed Network + */ + @JsonProperty(value = "subscriptions") + private List subscriptions; + + /* + * The collection of virtual nets covered by the Managed Network + */ + @JsonProperty(value = "virtualNetworks") + private List virtualNetworks; + + /* + * The collection of subnets covered by the Managed Network + */ + @JsonProperty(value = "subnets") + private List subnets; + + /** + * Get the managementGroups property: The collection of management groups covered by the Managed Network. + * + * @return the managementGroups value. + */ + public List managementGroups() { + return this.managementGroups; + } + + /** + * Set the managementGroups property: The collection of management groups covered by the Managed Network. + * + * @param managementGroups the managementGroups value to set. + * @return the Scope object itself. + */ + public Scope withManagementGroups(List managementGroups) { + this.managementGroups = managementGroups; + return this; + } + + /** + * Get the subscriptions property: The collection of subscriptions covered by the Managed Network. + * + * @return the subscriptions value. + */ + public List subscriptions() { + return this.subscriptions; + } + + /** + * Set the subscriptions property: The collection of subscriptions covered by the Managed Network. + * + * @param subscriptions the subscriptions value to set. + * @return the Scope object itself. + */ + public Scope withSubscriptions(List subscriptions) { + this.subscriptions = subscriptions; + return this; + } + + /** + * Get the virtualNetworks property: The collection of virtual nets covered by the Managed Network. + * + * @return the virtualNetworks value. + */ + public List virtualNetworks() { + return this.virtualNetworks; + } + + /** + * Set the virtualNetworks property: The collection of virtual nets covered by the Managed Network. + * + * @param virtualNetworks the virtualNetworks value to set. + * @return the Scope object itself. + */ + public Scope withVirtualNetworks(List virtualNetworks) { + this.virtualNetworks = virtualNetworks; + return this; + } + + /** + * Get the subnets property: The collection of subnets covered by the Managed Network. + * + * @return the subnets value. + */ + public List subnets() { + return this.subnets; + } + + /** + * Set the subnets property: The collection of subnets covered by the Managed Network. + * + * @param subnets the subnets value to set. + * @return the Scope object itself. + */ + public Scope withSubnets(List subnets) { + this.subnets = subnets; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (managementGroups() != null) { + managementGroups().forEach(e -> e.validate()); + } + if (subscriptions() != null) { + subscriptions().forEach(e -> e.validate()); + } + if (virtualNetworks() != null) { + virtualNetworks().forEach(e -> e.validate()); + } + if (subnets() != null) { + subnets().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignment.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignment.java new file mode 100644 index 0000000000000..8d10796344998 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignment.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managednetwork.fluent.models.ScopeAssignmentInner; + +/** An immutable client-side representation of ScopeAssignment. */ +public interface ScopeAssignment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the assignedManagedNetwork property: The managed network ID with scope will be assigned to. + * + * @return the assignedManagedNetwork value. + */ + String assignedManagedNetwork(); + + /** + * Gets the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.managednetwork.fluent.models.ScopeAssignmentInner object. + * + * @return the inner object. + */ + ScopeAssignmentInner innerModel(); + + /** The entirety of the ScopeAssignment definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The ScopeAssignment definition stages. */ + interface DefinitionStages { + /** The first stage of the ScopeAssignment definition. */ + interface Blank extends WithScope { + } + /** The stage of the ScopeAssignment definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies scope. + * + * @param scope The base resource of the scope assignment to create. The scope can be any REST resource + * instance. For example, use 'subscriptions/{subscription-id}' for a subscription, + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and + * 'subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @return the next definition stage. + */ + WithCreate withExistingScope(String scope); + } + /** + * The stage of the ScopeAssignment 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.WithLocation, DefinitionStages.WithAssignedManagedNetwork { + /** + * Executes the create request. + * + * @return the created resource. + */ + ScopeAssignment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ScopeAssignment create(Context context); + } + /** The stage of the ScopeAssignment definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** The stage of the ScopeAssignment definition allowing to specify assignedManagedNetwork. */ + interface WithAssignedManagedNetwork { + /** + * Specifies the assignedManagedNetwork property: The managed network ID with scope will be assigned to.. + * + * @param assignedManagedNetwork The managed network ID with scope will be assigned to. + * @return the next definition stage. + */ + WithCreate withAssignedManagedNetwork(String assignedManagedNetwork); + } + } + /** + * Begins update for the ScopeAssignment resource. + * + * @return the stage of resource update. + */ + ScopeAssignment.Update update(); + + /** The template for ScopeAssignment update. */ + interface Update extends UpdateStages.WithAssignedManagedNetwork { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ScopeAssignment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ScopeAssignment apply(Context context); + } + /** The ScopeAssignment update stages. */ + interface UpdateStages { + /** The stage of the ScopeAssignment update allowing to specify assignedManagedNetwork. */ + interface WithAssignedManagedNetwork { + /** + * Specifies the assignedManagedNetwork property: The managed network ID with scope will be assigned to.. + * + * @param assignedManagedNetwork The managed network ID with scope will be assigned to. + * @return the next definition stage. + */ + Update withAssignedManagedNetwork(String assignedManagedNetwork); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ScopeAssignment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ScopeAssignment refresh(Context context); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignmentListResult.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignmentListResult.java new file mode 100644 index 0000000000000..66ebccd331010 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignmentListResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managednetwork.fluent.models.ScopeAssignmentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list ScopeAssignment. It contains a list of groups and a URL link to get the next set of + * results. + */ +@Fluent +public final class ScopeAssignmentListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScopeAssignmentListResult.class); + + /* + * Gets a page of ScopeAssignment + */ + @JsonProperty(value = "value") + private List value; + + /* + * Gets the URL to get the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Gets a page of ScopeAssignment. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets a page of ScopeAssignment. + * + * @param value the value value to set. + * @return the ScopeAssignmentListResult object itself. + */ + public ScopeAssignmentListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets the URL to get the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets the URL to get the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ScopeAssignmentListResult object itself. + */ + public ScopeAssignmentListResult 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/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignments.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignments.java new file mode 100644 index 0000000000000..73642495a0c40 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignments.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.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 ScopeAssignments. */ +public interface ScopeAssignments { + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @param scopeAssignmentName The name of the scope assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 scope assignment. + */ + ScopeAssignment get(String scope, String scopeAssignmentName); + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @param scopeAssignmentName The name of the scope assignment to get. + * @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 scope assignment along with {@link Response}. + */ + Response getWithResponse(String scope, String scopeAssignmentName, Context context); + + /** + * Deletes a scope assignment. + * + * @param scope The scope of the scope assignment to delete. + * @param scopeAssignmentName The name of the scope assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 scope, String scopeAssignmentName); + + /** + * Deletes a scope assignment. + * + * @param scope The scope of the scope assignment to delete. + * @param scopeAssignmentName The name of the scope assignment to delete. + * @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 scope, String scopeAssignmentName, Context context); + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 scope assignment as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String scope); + + /** + * Get the specified scope assignment. + * + * @param scope The base resource of the scope assignment. + * @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 scope assignment as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String scope, Context context); + + /** + * Get the specified scope assignment. + * + * @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 scope assignment along with {@link Response}. + */ + ScopeAssignment getById(String id); + + /** + * Get the specified scope assignment. + * + * @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 scope assignment along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a scope assignment. + * + * @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 scope assignment. + * + * @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 ScopeAssignment resource. + * + * @param name resource name. + * @return the first stage of the new ScopeAssignment definition. + */ + ScopeAssignment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Type.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Type.java new file mode 100644 index 0000000000000..a00e9cbc40d76 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Type.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Type. */ +public final class Type extends ExpandableStringEnum { + /** Static value HubAndSpokeTopology for Type. */ + public static final Type HUB_AND_SPOKE_TOPOLOGY = fromString("HubAndSpokeTopology"); + + /** Static value MeshTopology for Type. */ + public static final Type MESH_TOPOLOGY = fromString("MeshTopology"); + + /** + * Creates or finds a Type from its string representation. + * + * @param name a name to look for. + * @return the corresponding Type. + */ + @JsonCreator + public static Type fromString(String name) { + return fromString(name, Type.class); + } + + /** @return known Type values. */ + public static Collection values() { + return values(Type.class); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/package-info.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/package-info.java new file mode 100644 index 0000000000000..09f18954338a7 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/package-info.java @@ -0,0 +1,10 @@ +// 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 ManagedNetworkManagementClient. The Microsoft Azure Managed Network management + * API provides a RESTful set of web services that interact with Microsoft Azure Networks service to programmatically + * view, control, change, and monitor your entire Azure network centrally and with ease. + */ +package com.azure.resourcemanager.managednetwork.models; diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/package-info.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/package-info.java new file mode 100644 index 0000000000000..de5fbbe69875e --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/package-info.java @@ -0,0 +1,10 @@ +// 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 ManagedNetworkManagementClient. The Microsoft Azure Managed Network management API + * provides a RESTful set of web services that interact with Microsoft Azure Networks service to programmatically view, + * control, change, and monitor your entire Azure network centrally and with ease. + */ +package com.azure.resourcemanager.managednetwork; diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/module-info.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/module-info.java new file mode 100644 index 0000000000000..6e4f04dee040b --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/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.managednetwork { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.managednetwork; + exports com.azure.resourcemanager.managednetwork.fluent; + exports com.azure.resourcemanager.managednetwork.fluent.models; + exports com.azure.resourcemanager.managednetwork.models; + + opens com.azure.resourcemanager.managednetwork.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.managednetwork.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsCreateOrUpdateSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0ae85caa5e0bb --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsCreateOrUpdateSamples.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.managednetwork.generated; + +import com.azure.resourcemanager.managednetwork.models.ResourceId; +import java.util.Arrays; + +/** Samples for ManagedNetworkGroups CreateOrUpdate. */ +public final class ManagedNetworkGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkGroup/ManagedNetworkGroupsPut.json + */ + /** + * Sample code: ManagementNetworkGroupsPut. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managementNetworkGroupsPut( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkGroups() + .define("myManagedNetworkGroup1") + .withExistingManagedNetwork("myResourceGroup", "myManagedNetwork") + .withManagementGroups(Arrays.asList()) + .withSubscriptions(Arrays.asList()) + .withVirtualNetworks( + Arrays + .asList( + new ResourceId() + .withId( + "/subscriptionB/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetA"), + new ResourceId() + .withId( + "/subscriptionB/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetB"))) + .withSubnets( + Arrays + .asList( + new ResourceId() + .withId( + "/subscriptionB/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetA/subnets/subnetA"))) + .create(); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsDeleteSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsDeleteSamples.java new file mode 100644 index 0000000000000..018858a0dc946 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsDeleteSamples.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.managednetwork.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedNetworkGroups Delete. */ +public final class ManagedNetworkGroupsDeleteSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkGroup/ManagedNetworkGroupsDelete.json + */ + /** + * Sample code: ManagementNetworkGroupsDelete. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managementNetworkGroupsDelete( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkGroups() + .delete("myResourceGroup", "myManagedNetwork", "myManagedNetworkGroup1", Context.NONE); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsGetSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsGetSamples.java new file mode 100644 index 0000000000000..521cb7aaeb12a --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsGetSamples.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.managednetwork.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedNetworkGroups Get. */ +public final class ManagedNetworkGroupsGetSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkGroup/ManagedNetworkGroupsGet.json + */ + /** + * Sample code: ManagementNetworkGroupsGet. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managementNetworkGroupsGet( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkGroups() + .getWithResponse("myResourceGroup", "myManagedNetwork", "myManagedNetworkGroup1", Context.NONE); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsListByManagedNetworkSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsListByManagedNetworkSamples.java new file mode 100644 index 0000000000000..317f6741e1e16 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsListByManagedNetworkSamples.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.managednetwork.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedNetworkGroups ListByManagedNetwork. */ +public final class ManagedNetworkGroupsListByManagedNetworkSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkGroup/ManagedNetworkGroupsListByManagedNetwork.json + */ + /** + * Sample code: ManagedNetworksGroupsListByManagedNetwork. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksGroupsListByManagedNetwork( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkGroups() + .listByManagedNetwork("myResourceGroup", "myManagedNetwork", null, null, Context.NONE); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesCreateOrUpdateSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..a07b6fe46e045 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.generated; + +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkPeeringPolicyProperties; +import com.azure.resourcemanager.managednetwork.models.ResourceId; +import com.azure.resourcemanager.managednetwork.models.Type; +import java.util.Arrays; + +/** Samples for ManagedNetworkPeeringPolicies CreateOrUpdate. */ +public final class ManagedNetworkPeeringPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkPeeringPolicy/ManagedNetworkPeeringPoliciesPut.json + */ + /** + * Sample code: ManagedNetworkPeeringPoliciesPut. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworkPeeringPoliciesPut( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkPeeringPolicies() + .define("myHubAndSpoke") + .withExistingManagedNetwork("myResourceGroup", "myManagedNetwork") + .withProperties( + new ManagedNetworkPeeringPolicyProperties() + .withType(Type.HUB_AND_SPOKE_TOPOLOGY) + .withHub( + new ResourceId() + .withId( + "/subscriptionB/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myHubVnet")) + .withSpokes( + Arrays + .asList( + new ResourceId() + .withId( + "/subscriptionB/resourceGroups/myResourceGroup/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork/managedNetworkGroups/myManagedNetworkGroup1")))) + .create(); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesDeleteSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesDeleteSamples.java new file mode 100644 index 0000000000000..b74930041295b --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesDeleteSamples.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.managednetwork.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedNetworkPeeringPolicies Delete. */ +public final class ManagedNetworkPeeringPoliciesDeleteSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkPeeringPolicy/ManagedNetworkPeeringPoliciesDelete.json + */ + /** + * Sample code: ManagedNetworkPeeringPoliciesDelete. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworkPeeringPoliciesDelete( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkPeeringPolicies() + .delete("myResourceGroup", "myManagedNetwork", "myHubAndSpoke", Context.NONE); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesGetSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesGetSamples.java new file mode 100644 index 0000000000000..bad8b430b7e94 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesGetSamples.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.managednetwork.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedNetworkPeeringPolicies Get. */ +public final class ManagedNetworkPeeringPoliciesGetSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkPeeringPolicy/ManagedNetworkPeeringPoliciesGet.json + */ + /** + * Sample code: ManagedNetworkPeeringPoliciesGet. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworkPeeringPoliciesGet( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkPeeringPolicies() + .getWithResponse("myResourceGroup", "myManagedNetwork", "myHubAndSpoke", Context.NONE); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesListByManagedNetworkSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesListByManagedNetworkSamples.java new file mode 100644 index 0000000000000..eefea2b5ba770 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesListByManagedNetworkSamples.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.managednetwork.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedNetworkPeeringPolicies ListByManagedNetwork. */ +public final class ManagedNetworkPeeringPoliciesListByManagedNetworkSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetworkPeeringPolicy/ManagedNetworkPeeringPoliciesListByManagedNetwork.json + */ + /** + * Sample code: ManagedNetworkPeeringPoliciesListByManagedNetwork. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworkPeeringPoliciesListByManagedNetwork( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworkPeeringPolicies() + .listByManagedNetwork("myResourceGroup", "myManagedNetwork", null, null, Context.NONE); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksCreateOrUpdateSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..6730d5c38579b --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksCreateOrUpdateSamples.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.managednetwork.generated; + +import com.azure.resourcemanager.managednetwork.models.ResourceId; +import com.azure.resourcemanager.managednetwork.models.Scope; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedNetworks CreateOrUpdate. */ +public final class ManagedNetworksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetwork/ManagedNetworksPut.json + */ + /** + * Sample code: ManagedNetworksPut. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksPut(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .managedNetworks() + .define("myManagedNetwork") + .withRegion("eastus") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf()) + .withScope( + new Scope() + .withManagementGroups( + Arrays + .asList( + new ResourceId() + .withId( + "/providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000"), + new ResourceId() + .withId( + "/providers/Microsoft.Management/managementGroups/20000000-0002-0000-0000-000000000000"))) + .withSubscriptions( + Arrays + .asList(new ResourceId().withId("subscriptionA"), new ResourceId().withId("subscriptionB"))) + .withVirtualNetworks( + Arrays + .asList( + new ResourceId() + .withId( + "/subscriptions/subscriptionC/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetA"), + new ResourceId() + .withId( + "/subscriptions/subscriptionC/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetB"))) + .withSubnets( + Arrays + .asList( + new ResourceId() + .withId( + "/subscriptions/subscriptionC/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetC/subnets/subnetA"), + new ResourceId() + .withId( + "/subscriptions/subscriptionC/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetC/subnets/subnetB")))) + .create(); + } + + @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/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksDeleteSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksDeleteSamples.java new file mode 100644 index 0000000000000..62d7e319b5f82 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedNetworks Delete. */ +public final class ManagedNetworksDeleteSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetwork/ManagedNetworksDelete.json + */ + /** + * Sample code: ManagedNetworksDelete. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksDelete(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager.managedNetworks().delete("myResourceGroup", "myManagedNetwork", Context.NONE); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksGetByResourceGroupSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..82ee291700af9 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedNetworks GetByResourceGroup. */ +public final class ManagedNetworksGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetwork/ManagedNetworksGet.json + */ + /** + * Sample code: ManagedNetworksGet. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksGet(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager.managedNetworks().getByResourceGroupWithResponse("myResourceGroup", "myManagedNetwork", Context.NONE); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksListByResourceGroupSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksListByResourceGroupSamples.java new file mode 100644 index 0000000000000..c351de5d01b6a --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksListByResourceGroupSamples.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.managednetwork.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedNetworks ListByResourceGroup. */ +public final class ManagedNetworksListByResourceGroupSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetwork/ManagedNetworksListByResourceGroup.json + */ + /** + * Sample code: ManagedNetworksListByResourceGroup. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksListByResourceGroup( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager.managedNetworks().listByResourceGroup("myResourceGroup", null, null, Context.NONE); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksListSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksListSamples.java new file mode 100644 index 0000000000000..5471bbbef7592 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksListSamples.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.managednetwork.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedNetworks List. */ +public final class ManagedNetworksListSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetwork/ManagedNetworksListBySubscription.json + */ + /** + * Sample code: ManagedNetworksListBySubscription. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksListBySubscription( + com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager.managedNetworks().list(null, null, Context.NONE); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksUpdateSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksUpdateSamples.java new file mode 100644 index 0000000000000..27192f3f5a54f --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.managednetwork.models.ManagedNetwork; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedNetworks Update. */ +public final class ManagedNetworksUpdateSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ManagedNetwork/ManagedNetworksPatch.json + */ + /** + * Sample code: ManagedNetworksPatch. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void managedNetworksPatch(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + ManagedNetwork resource = + manager + .managedNetworks() + .getByResourceGroupWithResponse("myResourceGroup", "myManagedNetwork", 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/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsCreateOrUpdateSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..9c99cd1a2734b --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsCreateOrUpdateSamples.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.managednetwork.generated; + +/** Samples for ScopeAssignments CreateOrUpdate. */ +public final class ScopeAssignmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ScopeAssignment/ScopeAssignmentsPut.json + */ + /** + * Sample code: ScopeAssignmentsPut. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void scopeAssignmentsPut(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .scopeAssignments() + .define("subscriptionCAssignment") + .withExistingScope("subscriptions/subscriptionC") + .withAssignedManagedNetwork( + "/subscriptions/subscriptionA/resourceGroups/myResourceGroup/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork") + .create(); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsDeleteSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsDeleteSamples.java new file mode 100644 index 0000000000000..5d2591b5083fb --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsDeleteSamples.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.managednetwork.generated; + +import com.azure.core.util.Context; + +/** Samples for ScopeAssignments Delete. */ +public final class ScopeAssignmentsDeleteSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ScopeAssignment/ScopeAssignmentsDelete.json + */ + /** + * Sample code: ScopeAssignmentsDelete. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void scopeAssignmentsDelete(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .scopeAssignments() + .deleteWithResponse("subscriptions/subscriptionC", "subscriptionCAssignment", Context.NONE); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsGetSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsGetSamples.java new file mode 100644 index 0000000000000..5926258e9c8b6 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsGetSamples.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.managednetwork.generated; + +import com.azure.core.util.Context; + +/** Samples for ScopeAssignments Get. */ +public final class ScopeAssignmentsGetSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ScopeAssignment/ScopeAssignmentsGet.json + */ + /** + * Sample code: ScopeAssignmentsGet. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void scopeAssignmentsGet(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager + .scopeAssignments() + .getWithResponse("subscriptions/subscriptionC", "subscriptionCAssignment", Context.NONE); + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsListSamples.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsListSamples.java new file mode 100644 index 0000000000000..119f570f2b399 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.generated; + +import com.azure.core.util.Context; + +/** Samples for ScopeAssignments List. */ +public final class ScopeAssignmentsListSamples { + /* + * x-ms-original-file: specification/managednetwork/resource-manager/Microsoft.ManagedNetwork/preview/2019-06-01-preview/examples/ScopeAssignment/ScopeAssignmentsList.json + */ + /** + * Sample code: ScopeAssignmentsList. + * + * @param manager Entry point to ManagedNetworkManager. + */ + public static void scopeAssignmentsList(com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager) { + manager.scopeAssignments().list("subscriptions/subscriptionC", Context.NONE); + } +} diff --git a/sdk/managednetwork/ci.yml b/sdk/managednetwork/ci.yml new file mode 100644 index 0000000000000..94f207d670237 --- /dev/null +++ b/sdk/managednetwork/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/managednetwork/ci.yml + - sdk/managednetwork/azure-resourcemanager-managednetwork/ + exclude: + - sdk/managednetwork/pom.xml + - sdk/managednetwork/azure-resourcemanager-managednetwork/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managednetwork/ci.yml + - sdk/managednetwork/azure-resourcemanager-managednetwork/ + exclude: + - sdk/managednetwork/pom.xml + - sdk/managednetwork/azure-resourcemanager-managednetwork/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: managednetwork + Artifacts: + - name: azure-resourcemanager-managednetwork + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermanagednetwork diff --git a/sdk/managednetwork/pom.xml b/sdk/managednetwork/pom.xml new file mode 100644 index 0000000000000..93f1e388f07fd --- /dev/null +++ b/sdk/managednetwork/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-managednetwork-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-managednetwork + + + +