From bcd11b27280de23f7b21b685bb8f7062308d9ab6 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 30 Apr 2025 17:29:09 +0000 Subject: [PATCH] CodeGen from PR 34371 in Azure/azure-rest-api-specs Merge 5a991e1ddde01c1ad3021a5d06676272f2ac00f5 into 37e1a52a30c527b6ad2d7ef09a9c82ad4491e8a2 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 8 + .../README.md | 102 ++ .../SAMPLE.md | 559 +++++++ .../pom.xml | 62 + .../managednetwork/ManagedNetworkManager.java | 349 +++++ .../fluent/ManagedNetworkGroupsClient.java | 215 +++ .../ManagedNetworkManagementClient.java | 84 ++ .../ManagedNetworkPeeringPoliciesClient.java | 220 +++ .../fluent/ManagedNetworksClient.java | 261 ++++ .../fluent/OperationsClient.java | 40 + .../fluent/ScopeAssignmentsClient.java | 133 ++ .../models/ManagedNetworkGroupInner.java | 308 ++++ .../models/ManagedNetworkGroupProperties.java | 235 +++ .../fluent/models/ManagedNetworkInner.java | 220 +++ .../ManagedNetworkPeeringPolicyInner.java | 179 +++ .../models/ManagedNetworkProperties.java | 159 ++ .../fluent/models/OperationInner.java | 125 ++ .../fluent/models/ScopeAssignmentInner.java | 207 +++ .../models/ScopeAssignmentProperties.java | 130 ++ .../fluent/models/package-info.java | 11 + .../managednetwork/fluent/package-info.java | 11 + .../ManagedNetworkGroupImpl.java | 220 +++ .../ManagedNetworkGroupsClientImpl.java | 1031 +++++++++++++ .../ManagedNetworkGroupsImpl.java | 164 ++ .../implementation/ManagedNetworkImpl.java | 188 +++ ...ManagedNetworkManagementClientBuilder.java | 140 ++ .../ManagedNetworkManagementClientImpl.java | 355 +++++ ...nagedNetworkPeeringPoliciesClientImpl.java | 1050 +++++++++++++ .../ManagedNetworkPeeringPoliciesImpl.java | 171 +++ .../ManagedNetworkPeeringPolicyImpl.java | 155 ++ .../ManagedNetworksClientImpl.java | 1313 +++++++++++++++++ .../implementation/ManagedNetworksImpl.java | 148 ++ .../implementation/OperationImpl.java | 37 + .../implementation/OperationsClientImpl.java | 233 +++ .../implementation/OperationsImpl.java | 45 + .../implementation/ResourceManagerUtils.java | 195 +++ .../implementation/ScopeAssignmentImpl.java | 154 ++ .../ScopeAssignmentsClientImpl.java | 634 ++++++++ .../implementation/ScopeAssignmentsImpl.java | 147 ++ .../implementation/package-info.java | 11 + .../models/ConnectivityCollection.java | 111 ++ .../HubAndSpokePeeringPolicyProperties.java | 170 +++ .../managednetwork/models/Kind.java | 46 + .../managednetwork/models/ManagedNetwork.java | 271 ++++ .../models/ManagedNetworkGroup.java | 376 +++++ .../models/ManagedNetworkGroupListResult.java | 130 ++ .../models/ManagedNetworkGroups.java | 159 ++ .../models/ManagedNetworkListResult.java | 129 ++ .../models/ManagedNetworkPeeringPolicies.java | 164 ++ .../models/ManagedNetworkPeeringPolicy.java | 224 +++ ...ManagedNetworkPeeringPolicyListResult.java | 131 ++ ...ManagedNetworkPeeringPolicyProperties.java | 234 +++ .../models/ManagedNetworkUpdate.java | 95 ++ .../models/ManagedNetworks.java | 179 +++ .../models/MeshPeeringPolicyProperties.java | 169 +++ .../managednetwork/models/Operation.java | 33 + .../models/OperationDisplay.java | 149 ++ .../models/OperationListResult.java | 128 ++ .../managednetwork/models/Operations.java | 35 + .../models/ProvisioningState.java | 61 + .../managednetwork/models/ResourceId.java | 93 ++ .../models/ResourceProperties.java | 119 ++ .../managednetwork/models/Scope.java | 196 +++ .../models/ScopeAssignment.java | 233 +++ .../models/ScopeAssignmentListResult.java | 129 ++ .../models/ScopeAssignments.java | 139 ++ .../managednetwork/models/Type.java | 51 + .../managednetwork/models/package-info.java | 11 + .../managednetwork/package-info.java | 11 + .../src/main/java/module-info.java | 15 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + ...-resourcemanager-managednetwork.properties | 1 + ...gedNetworkGroupsCreateOrUpdateSamples.java | 40 + .../ManagedNetworkGroupsDeleteSamples.java | 26 + .../ManagedNetworkGroupsGetSamples.java | 27 + ...workGroupsListByManagedNetworkSamples.java | 26 + ...kPeeringPoliciesCreateOrUpdateSamples.java | 38 + ...edNetworkPeeringPoliciesDeleteSamples.java | 26 + ...nagedNetworkPeeringPoliciesGetSamples.java | 26 + ...ngPoliciesListByManagedNetworkSamples.java | 26 + .../ManagedNetworksCreateOrUpdateSamples.java | 63 + .../ManagedNetworksDeleteSamples.java | 24 + ...agedNetworksGetByResourceGroupSamples.java | 25 + ...gedNetworksListByResourceGroupSamples.java | 25 + .../generated/ManagedNetworksListSamples.java | 25 + .../ManagedNetworksUpdateSamples.java | 43 + ...ScopeAssignmentsCreateOrUpdateSamples.java | 29 + .../ScopeAssignmentsDeleteSamples.java | 26 + .../generated/ScopeAssignmentsGetSamples.java | 26 + .../ScopeAssignmentsListSamples.java | 24 + sdk/managednetwork/ci.yml | 46 + sdk/managednetwork/pom.xml | 15 + 95 files changed, 14611 insertions(+) create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/CHANGELOG.md create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/README.md create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/SAMPLE.md create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/pom.xml create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/ManagedNetworkManager.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkGroupsClient.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkManagementClient.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkPeeringPoliciesClient.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworksClient.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/OperationsClient.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ScopeAssignmentsClient.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkGroupInner.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkGroupProperties.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkInner.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkPeeringPolicyInner.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkProperties.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/OperationInner.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ScopeAssignmentInner.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ScopeAssignmentProperties.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/package-info.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/package-info.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupsClientImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupsImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkManagementClientBuilder.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkManagementClientImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPoliciesClientImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPoliciesImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPolicyImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworksClientImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworksImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationsClientImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationsImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ResourceManagerUtils.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentsClientImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentsImpl.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/package-info.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ConnectivityCollection.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/HubAndSpokePeeringPolicyProperties.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Kind.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetwork.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroup.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroupListResult.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroups.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkListResult.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicies.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicy.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicyListResult.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicyProperties.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkUpdate.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworks.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/MeshPeeringPolicyProperties.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Operation.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/OperationDisplay.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/OperationListResult.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Operations.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ProvisioningState.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ResourceId.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ResourceProperties.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Scope.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignment.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignmentListResult.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignments.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Type.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/package-info.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/package-info.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/module-info.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managednetwork/proxy-config.json create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managednetwork/reflect-config.json create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/resources/azure-resourcemanager-managednetwork.properties create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsCreateOrUpdateSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsDeleteSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsGetSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsListByManagedNetworkSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesDeleteSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesGetSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesListByManagedNetworkSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksCreateOrUpdateSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksDeleteSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksGetByResourceGroupSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksListByResourceGroupSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksListSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksUpdateSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsCreateOrUpdateSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsDeleteSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsGetSamples.java create mode 100644 sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsListSamples.java create mode 100644 sdk/managednetwork/ci.yml create mode 100644 sdk/managednetwork/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b04d701dd93c..1650593e91ef 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -477,6 +477,7 @@ com.azure.resourcemanager:azure-resourcemanager-carbonoptimization;1.0.0-beta.1; com.azure.resourcemanager:azure-resourcemanager-dependencymap;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-portalservicescopilot;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-lambdatesthyperexecute;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-managednetwork;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.1;2.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 59226c65adf6..e2059519e536 100644 --- a/pom.xml +++ b/pom.xml @@ -140,6 +140,7 @@ sdk/machinelearning sdk/maintenance sdk/managedapplications + sdk/managednetwork sdk/managednetworkfabric sdk/managementgroups sdk/maps diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/CHANGELOG.md b/sdk/managednetwork/azure-resourcemanager-managednetwork/CHANGELOG.md new file mode 100644 index 000000000000..0dad84574e5d --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-04-30) + +- 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). +### Features Added + +- Initial release for the azure-resourcemanager-managednetwork Java SDK. diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/README.md b/sdk/managednetwork/azure-resourcemanager-managednetwork/README.md new file mode 100644 index 000000000000..3928f11ed961 --- /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] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ManagedNetworkManager manager = ManagedNetworkManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/managednetwork/azure-resourcemanager-managednetwork/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/SAMPLE.md b/sdk/managednetwork/azure-resourcemanager-managednetwork/SAMPLE.md new file mode 100644 index 000000000000..32a23cfa954c --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/SAMPLE.md @@ -0,0 +1,559 @@ +# 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 +/** + * 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", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedNetworkGroups_Delete + +```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(); + } +} +``` + +### ManagedNetworkGroups_Get + +```java +/** + * 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", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedNetworkGroups_ListByManagedNetwork + +```java +/** + * 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, com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedNetworkPeeringPolicies_CreateOrUpdate + +```java +/** + * 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", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedNetworkPeeringPolicies_Delete + +```java +/** + * 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", + com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedNetworkPeeringPolicies_Get + +```java +/** + * 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, com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedNetworkPeeringPolicies_ListByManagedNetwork + +```java +/** + * 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() + .deleteByResourceGroupWithResponse("subscriptions/subscriptionC", "subscriptionCAssignment", + com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedNetworks_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(); + } +} +``` + +### ManagedNetworks_Delete + +```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(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ManagedNetworks_GetByResourceGroup + +```java +/** + * 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", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedNetworks_List + +```java +/** + * 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", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedNetworks_ListByResourceGroup + +```java +/** + * 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", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedNetworks_Update + +```java +/** + * 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, com.azure.core.util.Context.NONE); + } +} +``` + +### ScopeAssignments_CreateOrUpdate + +```java +/** + * 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", + com.azure.core.util.Context.NONE); + } +} +``` + +### ScopeAssignments_Delete + +```java +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", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ScopeAssignments_Get + +```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(); + } +} +``` + +### ScopeAssignments_List + +```java +/** + * 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, com.azure.core.util.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 000000000000..c8cc622cd921 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/pom.xml @@ -0,0 +1,62 @@ + + + 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 + 0 + 0 + true + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + 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 000000000000..452d70ef7aad --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/ManagedNetworkManager.java @@ -0,0 +1,349 @@ +// 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.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.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.Map; +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); + } + + /** + * Creates an instance of ManagedNetwork service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ManagedNetwork service API instance. + */ + public static ManagedNetworkManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ManagedNetworkManager(httpPipeline, profile, null); + } + + /** + * 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 static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-managednetwork.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of 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."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.managednetwork") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ManagedNetworkManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of ManagedNetworks. It manages ManagedNetwork. + * + * @return Resource collection API of ManagedNetworks. + */ + public ManagedNetworks managedNetworks() { + if (this.managedNetworks == null) { + this.managedNetworks = new ManagedNetworksImpl(clientObject.getManagedNetworks(), this); + } + return managedNetworks; + } + + /** + * Gets the resource collection API of ScopeAssignments. It manages ScopeAssignment. + * + * @return Resource collection API of ScopeAssignments. + */ + public ScopeAssignments scopeAssignments() { + if (this.scopeAssignments == null) { + this.scopeAssignments = new ScopeAssignmentsImpl(clientObject.getScopeAssignments(), this); + } + return scopeAssignments; + } + + /** + * Gets the resource collection API of ManagedNetworkGroups. It manages ManagedNetworkGroup. + * + * @return Resource collection API of ManagedNetworkGroups. + */ + public ManagedNetworkGroups managedNetworkGroups() { + if (this.managedNetworkGroups == null) { + this.managedNetworkGroups = new ManagedNetworkGroupsImpl(clientObject.getManagedNetworkGroups(), this); + } + return managedNetworkGroups; + } + + /** + * Gets the resource collection API of ManagedNetworkPeeringPolicies. It manages ManagedNetworkPeeringPolicy. + * + * @return Resource collection API of ManagedNetworkPeeringPolicies. + */ + public ManagedNetworkPeeringPolicies managedNetworkPeeringPolicies() { + if (this.managedNetworkPeeringPolicies == null) { + this.managedNetworkPeeringPolicies + = new ManagedNetworkPeeringPoliciesImpl(clientObject.getManagedNetworkPeeringPolicies(), this); + } + return managedNetworkPeeringPolicies; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets wrapped service client ManagedNetworkManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client ManagedNetworkManagementClient. + */ + 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 000000000000..ddeca2033aa7 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkGroupsClient.java @@ -0,0 +1,215 @@ +// 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. + * @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 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 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 000000000000..ac2f2a38fc5c --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkManagementClient.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.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 000000000000..299b881da072 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworkPeeringPoliciesClient.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.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. + * @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 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 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 000000000000..b018c21c9d78 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ManagedNetworksClient.java @@ -0,0 +1,261 @@ +// 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. + * @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 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 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 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 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 000000000000..f074a36d7a60 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 000000000000..3206884f0ae9 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/ScopeAssignmentsClient.java @@ -0,0 +1,133 @@ +// 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. + * @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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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 000000000000..e8592d8bf541 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkGroupInner.java @@ -0,0 +1,308 @@ +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.models.Kind; +import com.azure.resourcemanager.managednetwork.models.ProvisioningState; +import com.azure.resourcemanager.managednetwork.models.ResourceId; +import java.io.IOException; +import java.util.List; + +/** + * The Managed Network Group resource. + */ +@Fluent +public final class ManagedNetworkGroupInner extends ProxyResource { + /* + * Gets or sets the properties of a network group + */ + private ManagedNetworkGroupProperties innerProperties; + + /* + * Responsibility role under which this Managed Network Group will be created + */ + private Kind kind; + + /* + * The geo-location where the resource lives + */ + private String location; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ManagedNetworkGroupInner class. + */ + public ManagedNetworkGroupInner() { + } + + /** + * 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 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 ManagedNetworkGroupInner object itself. + */ + public ManagedNetworkGroupInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedNetworkGroupInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedNetworkGroupInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedNetworkGroupInner. + */ + public static ManagedNetworkGroupInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedNetworkGroupInner deserializedManagedNetworkGroupInner = new ManagedNetworkGroupInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedManagedNetworkGroupInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedManagedNetworkGroupInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedManagedNetworkGroupInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedManagedNetworkGroupInner.innerProperties + = ManagedNetworkGroupProperties.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedManagedNetworkGroupInner.kind = Kind.fromString(reader.getString()); + } else if ("location".equals(fieldName)) { + deserializedManagedNetworkGroupInner.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedNetworkGroupInner; + }); + } +} 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 000000000000..ec4a80f8f4fa --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkGroupProperties.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.models.ProvisioningState; +import com.azure.resourcemanager.managednetwork.models.ResourceId; +import com.azure.resourcemanager.managednetwork.models.ResourceProperties; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a Managed Network Group. + */ +@Fluent +public final class ManagedNetworkGroupProperties extends ResourceProperties { + /* + * The collection of management groups covered by the Managed Network + */ + private List managementGroups; + + /* + * The collection of subscriptions covered by the Managed Network + */ + private List subscriptions; + + /* + * The collection of virtual nets covered by the Managed Network + */ + private List virtualNetworks; + + /* + * The collection of subnets covered by the Managed Network + */ + private List subnets; + + /* + * A unique read-only string that changes whenever the resource is updated. + */ + private String etag; + + /* + * Provisioning state of the ManagedNetwork resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of ManagedNetworkGroupProperties class. + */ + public ManagedNetworkGroupProperties() { + } + + /** + * 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; + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + @Override + public String etag() { + return this.etag; + } + + /** + * Get the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + @Override + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("managementGroups", this.managementGroups, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("subscriptions", this.subscriptions, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("virtualNetworks", this.virtualNetworks, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("subnets", this.subnets, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedNetworkGroupProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedNetworkGroupProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ManagedNetworkGroupProperties. + */ + public static ManagedNetworkGroupProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedNetworkGroupProperties deserializedManagedNetworkGroupProperties + = new ManagedNetworkGroupProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedManagedNetworkGroupProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("etag".equals(fieldName)) { + deserializedManagedNetworkGroupProperties.etag = reader.getString(); + } else if ("managementGroups".equals(fieldName)) { + List managementGroups = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedManagedNetworkGroupProperties.managementGroups = managementGroups; + } else if ("subscriptions".equals(fieldName)) { + List subscriptions = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedManagedNetworkGroupProperties.subscriptions = subscriptions; + } else if ("virtualNetworks".equals(fieldName)) { + List virtualNetworks = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedManagedNetworkGroupProperties.virtualNetworks = virtualNetworks; + } else if ("subnets".equals(fieldName)) { + List subnets = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedManagedNetworkGroupProperties.subnets = subnets; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedNetworkGroupProperties; + }); + } +} 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 000000000000..b54b3dfe4ef3 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.models.ConnectivityCollection; +import com.azure.resourcemanager.managednetwork.models.ProvisioningState; +import com.azure.resourcemanager.managednetwork.models.Scope; +import java.io.IOException; +import java.util.Map; + +/** + * The Managed Network resource. + */ +@Fluent +public final class ManagedNetworkInner extends Resource { + /* + * The MNC properties + */ + private ManagedNetworkProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ManagedNetworkInner class. + */ + public ManagedNetworkInner() { + } + + /** + * Get the innerProperties property: The MNC properties. + * + * @return the innerProperties value. + */ + private ManagedNetworkProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedNetworkInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedNetworkInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedNetworkInner. + */ + public static ManagedNetworkInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedNetworkInner deserializedManagedNetworkInner = new ManagedNetworkInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedManagedNetworkInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedManagedNetworkInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedManagedNetworkInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedManagedNetworkInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedManagedNetworkInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedManagedNetworkInner.innerProperties = ManagedNetworkProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedNetworkInner; + }); + } +} 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 000000000000..17db2832b790 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkPeeringPolicyInner.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.models.ManagedNetworkPeeringPolicyProperties; +import java.io.IOException; + +/** + * The Managed Network Peering Policy resource. + */ +@Fluent +public final class ManagedNetworkPeeringPolicyInner extends ProxyResource { + /* + * Gets or sets the properties of a Managed Network Policy + */ + private ManagedNetworkPeeringPolicyProperties properties; + + /* + * The geo-location where the resource lives + */ + private String location; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ManagedNetworkPeeringPolicyInner class. + */ + public ManagedNetworkPeeringPolicyInner() { + } + + /** + * 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; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedNetworkPeeringPolicyInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedNetworkPeeringPolicyInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedNetworkPeeringPolicyInner. + */ + public static ManagedNetworkPeeringPolicyInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedNetworkPeeringPolicyInner deserializedManagedNetworkPeeringPolicyInner + = new ManagedNetworkPeeringPolicyInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedManagedNetworkPeeringPolicyInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedManagedNetworkPeeringPolicyInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedManagedNetworkPeeringPolicyInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedManagedNetworkPeeringPolicyInner.properties + = ManagedNetworkPeeringPolicyProperties.fromJson(reader); + } else if ("location".equals(fieldName)) { + deserializedManagedNetworkPeeringPolicyInner.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedNetworkPeeringPolicyInner; + }); + } +} 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 000000000000..d77b0cca83cd --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ManagedNetworkProperties.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.models.ConnectivityCollection; +import com.azure.resourcemanager.managednetwork.models.ProvisioningState; +import com.azure.resourcemanager.managednetwork.models.ResourceProperties; +import com.azure.resourcemanager.managednetwork.models.Scope; +import java.io.IOException; + +/** + * Properties of Managed Network. + */ +@Fluent +public final class ManagedNetworkProperties extends ResourceProperties { + /* + * 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 + */ + private Scope scope; + + /* + * The collection of groups and policies concerned with connectivity + */ + private ConnectivityCollection connectivity; + + /* + * A unique read-only string that changes whenever the resource is updated. + */ + private String etag; + + /* + * Provisioning state of the ManagedNetwork resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of ManagedNetworkProperties class. + */ + public ManagedNetworkProperties() { + } + + /** + * 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; + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + @Override + public String etag() { + return this.etag; + } + + /** + * Get the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + @Override + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (scope() != null) { + scope().validate(); + } + if (connectivity() != null) { + connectivity().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("scope", this.scope); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedNetworkProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedNetworkProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ManagedNetworkProperties. + */ + public static ManagedNetworkProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedNetworkProperties deserializedManagedNetworkProperties = new ManagedNetworkProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedManagedNetworkProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("etag".equals(fieldName)) { + deserializedManagedNetworkProperties.etag = reader.getString(); + } else if ("scope".equals(fieldName)) { + deserializedManagedNetworkProperties.scope = Scope.fromJson(reader); + } else if ("connectivity".equals(fieldName)) { + deserializedManagedNetworkProperties.connectivity = ConnectivityCollection.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedNetworkProperties; + }); + } +} 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 000000000000..14022d229b8f --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/OperationInner.java @@ -0,0 +1,125 @@ +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.models.OperationDisplay; +import java.io.IOException; + +/** + * REST API operation. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * Operation name: {provider}/{resource}/{operation} + */ + private String name; + + /* + * The object that represents the operation. + */ + private OperationDisplay display; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} 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 000000000000..7fe22a1f36e3 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ScopeAssignmentInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.models.ProvisioningState; +import java.io.IOException; + +/** + * The Managed Network resource. + */ +@Fluent +public final class ScopeAssignmentInner extends ProxyResource { + /* + * The Scope Assignment properties + */ + private ScopeAssignmentProperties innerProperties; + + /* + * The geo-location where the resource lives + */ + private String location; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ScopeAssignmentInner class. + */ + public ScopeAssignmentInner() { + } + + /** + * 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 type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScopeAssignmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScopeAssignmentInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ScopeAssignmentInner. + */ + public static ScopeAssignmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScopeAssignmentInner deserializedScopeAssignmentInner = new ScopeAssignmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedScopeAssignmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedScopeAssignmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedScopeAssignmentInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedScopeAssignmentInner.innerProperties = ScopeAssignmentProperties.fromJson(reader); + } else if ("location".equals(fieldName)) { + deserializedScopeAssignmentInner.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedScopeAssignmentInner; + }); + } +} 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 000000000000..1381854d86db --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/ScopeAssignmentProperties.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.models.ProvisioningState; +import com.azure.resourcemanager.managednetwork.models.ResourceProperties; +import java.io.IOException; + +/** + * Properties of Managed Network. + */ +@Fluent +public final class ScopeAssignmentProperties extends ResourceProperties { + /* + * The managed network ID with scope will be assigned to. + */ + private String assignedManagedNetwork; + + /* + * A unique read-only string that changes whenever the resource is updated. + */ + private String etag; + + /* + * Provisioning state of the ManagedNetwork resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of ScopeAssignmentProperties class. + */ + public ScopeAssignmentProperties() { + } + + /** + * 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; + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + @Override + public String etag() { + return this.etag; + } + + /** + * Get the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + @Override + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("assignedManagedNetwork", this.assignedManagedNetwork); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScopeAssignmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScopeAssignmentProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ScopeAssignmentProperties. + */ + public static ScopeAssignmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScopeAssignmentProperties deserializedScopeAssignmentProperties = new ScopeAssignmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedScopeAssignmentProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("etag".equals(fieldName)) { + deserializedScopeAssignmentProperties.etag = reader.getString(); + } else if ("assignedManagedNetwork".equals(fieldName)) { + deserializedScopeAssignmentProperties.assignedManagedNetwork = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedScopeAssignmentProperties; + }); + } +} 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 000000000000..52ebc59a8020 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/models/package-info.java @@ -0,0 +1,11 @@ +// 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 000000000000..6b9efeff5ffa --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/fluent/package-info.java @@ -0,0 +1,11 @@ +// 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 000000000000..a98b0b1228bb --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupImpl.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.management.Region; +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 String location() { + return this.innerModel().location(); + } + + 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 Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedNetworkName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "managedNetworks"); + this.managedNetworkGroupName + = ResourceManagerUtils.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 withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ManagedNetworkGroupImpl withRegion(String location) { + this.innerModel().withLocation(location); + 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 000000000000..4d090cc35c01 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupsClientImpl.java @@ -0,0 +1,1031 @@ +// 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.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 { + /** + * 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") + public 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(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 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 getWithResponse(resourceGroupName, managedNetworkName, managedNetworkGroupName, Context.NONE).getValue(); + } + + /** + * 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 this + .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 this + .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 this.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 this.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 URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 000000000000..ed57ec2a8f10 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkGroupsImpl.java @@ -0,0 +1,164 @@ +// 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; + +public final class ManagedNetworkGroupsImpl implements ManagedNetworkGroups { + private static 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 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 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 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new ManagedNetworkGroupImpl(inner1, this.manager())); + } + + public ManagedNetworkGroup getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedNetworkName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedNetworkName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedNetworkName = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedNetworkName = ResourceManagerUtils.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 = ResourceManagerUtils.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 000000000000..a596f504a626 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedNetworkName = ResourceManagerUtils.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 000000000000..87853935081e --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkManagementClientBuilder.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.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 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 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 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() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + ManagedNetworkManagementClientImpl client = new ManagedNetworkManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + 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 000000000000..2b442b480780 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkManagementClientImpl.java @@ -0,0 +1,355 @@ +// 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.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.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 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 { + /** + * 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) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedNetworkManagementClientImpl.class); +} 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 000000000000..795e2838004f --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPoliciesClientImpl.java @@ -0,0 +1,1050 @@ +// 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.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 { + /** + * 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") + public 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(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 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 getWithResponse(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, Context.NONE) + .getValue(); + } + + /** + * 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 this + .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 this + .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 this.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 this.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 URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 000000000000..3c3ef5e94f92 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPoliciesImpl.java @@ -0,0 +1,171 @@ +// 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; + +public final class ManagedNetworkPeeringPoliciesImpl implements ManagedNetworkPeeringPolicies { + private static 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 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 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 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, + inner1 -> new ManagedNetworkPeeringPolicyImpl(inner1, this.manager())); + } + + public ManagedNetworkPeeringPolicy getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedNetworkName = ResourceManagerUtils.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 + = ResourceManagerUtils.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 = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedNetworkName = ResourceManagerUtils.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 + = ResourceManagerUtils.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 = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedNetworkName = ResourceManagerUtils.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 + = ResourceManagerUtils.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 = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedNetworkName = ResourceManagerUtils.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 + = ResourceManagerUtils.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 000000000000..babfd0f012f5 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworkPeeringPolicyImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 String resourceGroupName() { + return resourceGroupName; + } + + 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 = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedNetworkName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "managedNetworks"); + this.managedNetworkPeeringPolicyName + = ResourceManagerUtils.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 000000000000..015bfe5c1511 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworksClientImpl.java @@ -0,0 +1,1313 @@ +// 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.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 { + /** + * 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") + public 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(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 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 getByResourceGroupWithResponse(resourceGroupName, managedNetworkName, Context.NONE).getValue(); + } + + /** + * 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(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 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 createOrUpdateWithResponse(resourceGroupName, managedNetworkName, managedNetwork, Context.NONE) + .getValue(); + } + + /** + * 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 this.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 this.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 this.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 this.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 URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 000000000000..14e3a4e373d6 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ManagedNetworksImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +public final class ManagedNetworksImpl implements ManagedNetworks { + private static 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 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 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 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 ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new ManagedNetworkImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new ManagedNetworkImpl(inner1, this.manager())); + } + + public ManagedNetwork getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedNetworkName = ResourceManagerUtils.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 = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedNetworkName = ResourceManagerUtils.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 = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedNetworkName = ResourceManagerUtils.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 = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedNetworkName = ResourceManagerUtils.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 000000000000..8d7c7226b9cb --- /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 000000000000..ecaa90f2b176 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationsClientImpl.java @@ -0,0 +1,233 @@ +// 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.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 { + /** + * 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") + public 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 URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 000000000000..2ab4d3f2deea --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +public final class OperationsImpl implements Operations { + private static 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 ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managednetwork.ManagedNetworkManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ResourceManagerUtils.java b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..6bd7dff2b75e --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/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 000000000000..0c79c602ce5b --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentImpl.java @@ -0,0 +1,154 @@ +// 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 = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}", "scope"); + this.scopeAssignmentName = ResourceManagerUtils.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 000000000000..9f234d1076b2 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentsClientImpl.java @@ -0,0 +1,634 @@ +// 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.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 { + /** + * 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") + public 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(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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(); + } + + /** + * 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 getWithResponse(scope, scopeAssignmentName, Context.NONE).getValue(); + } + + /** + * 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(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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(); + } + + /** + * 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 createOrUpdateWithResponse(scope, scopeAssignmentName, parameters, Context.NONE).getValue(); + } + + /** + * 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(ignored -> 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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) { + deleteWithResponse(scope, scopeAssignmentName, Context.NONE); + } + + /** + * 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 URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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 000000000000..00cd9cb997c1 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/ScopeAssignmentsImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +public final class ScopeAssignmentsImpl implements ScopeAssignments { + private static 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 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 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 deleteByResourceGroupWithResponse(String scope, String scopeAssignmentName, Context context) { + return this.serviceClient().deleteWithResponse(scope, scopeAssignmentName, context); + } + + public void deleteByResourceGroup(String scope, String scopeAssignmentName) { + this.serviceClient().delete(scope, scopeAssignmentName); + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ScopeAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ScopeAssignmentImpl(inner1, this.manager())); + } + + public ScopeAssignment getById(String id) { + String scope = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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 = ResourceManagerUtils.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.deleteByResourceGroupWithResponse(scope, scopeAssignmentName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String scope = ResourceManagerUtils.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 = ResourceManagerUtils.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.deleteByResourceGroupWithResponse(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/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 000000000000..d7392ef836a9 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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 000000000000..82a3e162e129 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ConnectivityCollection.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkGroupInner; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkPeeringPolicyInner; +import java.io.IOException; +import java.util.List; + +/** + * The collection of Connectivity related groups and policies within the Managed Network. + */ +@Immutable +public final class ConnectivityCollection implements JsonSerializable { + /* + * The collection of connectivity related Managed Network Groups within the Managed Network + */ + private List groups; + + /* + * The collection of Managed Network Peering Policies within the Managed Network + */ + private List peerings; + + /** + * Creates an instance of ConnectivityCollection class. + */ + public ConnectivityCollection() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectivityCollection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectivityCollection if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectivityCollection. + */ + public static ConnectivityCollection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectivityCollection deserializedConnectivityCollection = new ConnectivityCollection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("groups".equals(fieldName)) { + List groups + = reader.readArray(reader1 -> ManagedNetworkGroupInner.fromJson(reader1)); + deserializedConnectivityCollection.groups = groups; + } else if ("peerings".equals(fieldName)) { + List peerings + = reader.readArray(reader1 -> ManagedNetworkPeeringPolicyInner.fromJson(reader1)); + deserializedConnectivityCollection.peerings = peerings; + } else { + reader.skipChildren(); + } + } + + return deserializedConnectivityCollection; + }); + } +} 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 000000000000..e644a2864d2c --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/HubAndSpokePeeringPolicyProperties.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a Hub and Spoke Peering Policy. + */ +@Fluent +public final class HubAndSpokePeeringPolicyProperties extends ManagedNetworkPeeringPolicyProperties { + /* + * A unique read-only string that changes whenever the resource is updated. + */ + private String etag; + + /* + * Provisioning state of the ManagedNetwork resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of HubAndSpokePeeringPolicyProperties class. + */ + public HubAndSpokePeeringPolicyProperties() { + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + @Override + public String etag() { + return this.etag; + } + + /** + * Get the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + @Override + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@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() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property type in model HubAndSpokePeeringPolicyProperties")); + } + if (hub() != null) { + hub().validate(); + } + if (spokes() != null) { + spokes().forEach(e -> e.validate()); + } + if (mesh() != null) { + mesh().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HubAndSpokePeeringPolicyProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeJsonField("hub", hub()); + jsonWriter.writeArrayField("spokes", spokes(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("mesh", mesh(), (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HubAndSpokePeeringPolicyProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HubAndSpokePeeringPolicyProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the HubAndSpokePeeringPolicyProperties. + */ + public static HubAndSpokePeeringPolicyProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HubAndSpokePeeringPolicyProperties deserializedHubAndSpokePeeringPolicyProperties + = new HubAndSpokePeeringPolicyProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedHubAndSpokePeeringPolicyProperties.withType(Type.fromString(reader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedHubAndSpokePeeringPolicyProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("etag".equals(fieldName)) { + deserializedHubAndSpokePeeringPolicyProperties.etag = reader.getString(); + } else if ("hub".equals(fieldName)) { + deserializedHubAndSpokePeeringPolicyProperties.withHub(ResourceId.fromJson(reader)); + } else if ("spokes".equals(fieldName)) { + List spokes = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedHubAndSpokePeeringPolicyProperties.withSpokes(spokes); + } else if ("mesh".equals(fieldName)) { + List mesh = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedHubAndSpokePeeringPolicyProperties.withMesh(mesh); + } else { + reader.skipChildren(); + } + } + + return deserializedHubAndSpokePeeringPolicyProperties; + }); + } +} 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 000000000000..efc32abb251a --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Kind.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Responsibility role under which this Managed Network Group will be created. + */ +public final class Kind extends ExpandableStringEnum { + /** + * Static value Connectivity for Kind. + */ + public static final Kind CONNECTIVITY = fromString("Connectivity"); + + /** + * Creates a new instance of Kind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Kind() { + } + + /** + * Creates or finds a Kind from its string representation. + * + * @param name a name to look for. + * @return the corresponding Kind. + */ + public static Kind fromString(String name) { + return fromString(name, Kind.class); + } + + /** + * Gets known Kind values. + * + * @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 000000000000..767874d74165 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetwork.java @@ -0,0 +1,271 @@ +// 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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 000000000000..9f25d89ed87b --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroup.java @@ -0,0 +1,376 @@ +// 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.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 location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * 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 region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.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.WithLocation, 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 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 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 000000000000..63c0a2e4d25d --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroupListResult.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkGroupInner; +import java.io.IOException; +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 implements JsonSerializable { + /* + * Gets a page of ManagedNetworkGroup + */ + private List value; + + /* + * Gets the URL to get the next set of results. + */ + private String nextLink; + + /** + * Creates an instance of ManagedNetworkGroupListResult class. + */ + public ManagedNetworkGroupListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedNetworkGroupListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedNetworkGroupListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ManagedNetworkGroupListResult. + */ + public static ManagedNetworkGroupListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedNetworkGroupListResult deserializedManagedNetworkGroupListResult + = new ManagedNetworkGroupListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ManagedNetworkGroupInner.fromJson(reader1)); + deserializedManagedNetworkGroupListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedManagedNetworkGroupListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedNetworkGroupListResult; + }); + } +} 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 000000000000..c8d8052e7289 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkGroups.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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. + * @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 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 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 000000000000..bb7567e00952 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkListResult.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkInner; +import java.io.IOException; +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 implements JsonSerializable { + /* + * Gets a page of ManagedNetworks + */ + private List value; + + /* + * Gets the URL to get the next page of results. + */ + private String nextLink; + + /** + * Creates an instance of ManagedNetworkListResult class. + */ + public ManagedNetworkListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedNetworkListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedNetworkListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ManagedNetworkListResult. + */ + public static ManagedNetworkListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedNetworkListResult deserializedManagedNetworkListResult = new ManagedNetworkListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ManagedNetworkInner.fromJson(reader1)); + deserializedManagedNetworkListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedManagedNetworkListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedNetworkListResult; + }); + } +} 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 000000000000..28e2bacf4816 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicies.java @@ -0,0 +1,164 @@ +// 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. + * @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 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 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 000000000000..a03aaa5c805e --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicy.java @@ -0,0 +1,224 @@ +// 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * 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 000000000000..1762a2b4d6cb --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicyListResult.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.fluent.models.ManagedNetworkPeeringPolicyInner; +import java.io.IOException; +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 + implements JsonSerializable { + /* + * Gets a page of Peering Policies + */ + private List value; + + /* + * Gets the URL to get the next page of results. + */ + private String nextLink; + + /** + * Creates an instance of ManagedNetworkPeeringPolicyListResult class. + */ + public ManagedNetworkPeeringPolicyListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedNetworkPeeringPolicyListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedNetworkPeeringPolicyListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ManagedNetworkPeeringPolicyListResult. + */ + public static ManagedNetworkPeeringPolicyListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedNetworkPeeringPolicyListResult deserializedManagedNetworkPeeringPolicyListResult + = new ManagedNetworkPeeringPolicyListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ManagedNetworkPeeringPolicyInner.fromJson(reader1)); + deserializedManagedNetworkPeeringPolicyListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedManagedNetworkPeeringPolicyListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedNetworkPeeringPolicyListResult; + }); + } +} 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 000000000000..70da0f9a0a78 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkPeeringPolicyProperties.java @@ -0,0 +1,234 @@ +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a Managed Network Peering Policy. + */ +@Fluent +public class ManagedNetworkPeeringPolicyProperties extends ResourceProperties { + /* + * Gets or sets the connectivity type of a network structure policy + */ + private Type type; + + /* + * Gets or sets the hub virtual network ID + */ + private ResourceId hub; + + /* + * Gets or sets the spokes group IDs + */ + private List spokes; + + /* + * Gets or sets the mesh group IDs + */ + private List mesh; + + /* + * A unique read-only string that changes whenever the resource is updated. + */ + private String etag; + + /* + * Provisioning state of the ManagedNetwork resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of ManagedNetworkPeeringPolicyProperties class. + */ + public ManagedNetworkPeeringPolicyProperties() { + } + + /** + * 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; + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + @Override + public String etag() { + return this.etag; + } + + /** + * Get the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + @Override + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(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()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedNetworkPeeringPolicyProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeJsonField("hub", this.hub); + jsonWriter.writeArrayField("spokes", this.spokes, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("mesh", this.mesh, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedNetworkPeeringPolicyProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedNetworkPeeringPolicyProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedNetworkPeeringPolicyProperties. + */ + public static ManagedNetworkPeeringPolicyProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedNetworkPeeringPolicyProperties deserializedManagedNetworkPeeringPolicyProperties + = new ManagedNetworkPeeringPolicyProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedManagedNetworkPeeringPolicyProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("etag".equals(fieldName)) { + deserializedManagedNetworkPeeringPolicyProperties.etag = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedManagedNetworkPeeringPolicyProperties.type = Type.fromString(reader.getString()); + } else if ("hub".equals(fieldName)) { + deserializedManagedNetworkPeeringPolicyProperties.hub = ResourceId.fromJson(reader); + } else if ("spokes".equals(fieldName)) { + List spokes = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedManagedNetworkPeeringPolicyProperties.spokes = spokes; + } else if ("mesh".equals(fieldName)) { + List mesh = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedManagedNetworkPeeringPolicyProperties.mesh = mesh; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedNetworkPeeringPolicyProperties; + }); + } +} 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 000000000000..4f4435799e59 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworkUpdate.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Update Tags of Managed Network. + */ +@Fluent +public final class ManagedNetworkUpdate implements JsonSerializable { + /* + * Resource tags + */ + private Map tags; + + /** + * Creates an instance of ManagedNetworkUpdate class. + */ + public ManagedNetworkUpdate() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedNetworkUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedNetworkUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ManagedNetworkUpdate. + */ + public static ManagedNetworkUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedNetworkUpdate deserializedManagedNetworkUpdate = new ManagedNetworkUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedManagedNetworkUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedNetworkUpdate; + }); + } +} 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 000000000000..f57c697aaf98 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ManagedNetworks.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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. + * @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 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 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 000000000000..ce678d498e04 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/MeshPeeringPolicyProperties.java @@ -0,0 +1,169 @@ +// 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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a Mesh Peering Policy. + */ +@Fluent +public final class MeshPeeringPolicyProperties extends ManagedNetworkPeeringPolicyProperties { + /* + * A unique read-only string that changes whenever the resource is updated. + */ + private String etag; + + /* + * Provisioning state of the ManagedNetwork resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of MeshPeeringPolicyProperties class. + */ + public MeshPeeringPolicyProperties() { + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + @Override + public String etag() { + return this.etag; + } + + /** + * Get the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + @Override + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@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() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property type in model MeshPeeringPolicyProperties")); + } + if (hub() != null) { + hub().validate(); + } + if (spokes() != null) { + spokes().forEach(e -> e.validate()); + } + if (mesh() != null) { + mesh().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MeshPeeringPolicyProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeJsonField("hub", hub()); + jsonWriter.writeArrayField("spokes", spokes(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("mesh", mesh(), (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MeshPeeringPolicyProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MeshPeeringPolicyProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MeshPeeringPolicyProperties. + */ + public static MeshPeeringPolicyProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MeshPeeringPolicyProperties deserializedMeshPeeringPolicyProperties = new MeshPeeringPolicyProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedMeshPeeringPolicyProperties.withType(Type.fromString(reader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedMeshPeeringPolicyProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("etag".equals(fieldName)) { + deserializedMeshPeeringPolicyProperties.etag = reader.getString(); + } else if ("hub".equals(fieldName)) { + deserializedMeshPeeringPolicyProperties.withHub(ResourceId.fromJson(reader)); + } else if ("spokes".equals(fieldName)) { + List spokes = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedMeshPeeringPolicyProperties.withSpokes(spokes); + } else if ("mesh".equals(fieldName)) { + List mesh = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedMeshPeeringPolicyProperties.withMesh(mesh); + } else { + reader.skipChildren(); + } + } + + return deserializedMeshPeeringPolicyProperties; + }); + } +} 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 000000000000..ac3620b5836c --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Operation.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.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 000000000000..3374cea41513 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/OperationDisplay.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The object that represents the operation. + */ +@Fluent +public final class OperationDisplay implements JsonSerializable { + /* + * Service provider: Microsoft.ManagedNetwork + */ + private String provider; + + /* + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + private String resource; + + /* + * Operation type: Read, write, delete, etc. + */ + private String operation; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("provider", this.provider); + jsonWriter.writeStringField("resource", this.resource); + jsonWriter.writeStringField("operation", this.operation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} 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 000000000000..a2520a2f30ce --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/OperationListResult.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.fluent.models.OperationInner; +import java.io.IOException; +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 implements JsonSerializable { + /* + * List of Resource Provider operations supported by the Managed Network resource provider. + */ + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: List of 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/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 000000000000..03d09bfe6772 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 000000000000..10890589841b --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ProvisioningState.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Provisioning state of the ManagedNetwork resource. + */ +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 a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/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 000000000000..f25c744f9899 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ResourceId.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Generic pointer to a resource. + */ +@Fluent +public final class ResourceId implements JsonSerializable { + /* + * Resource Id + */ + private String id; + + /** + * Creates an instance of ResourceId class. + */ + public ResourceId() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceId from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceId if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the ResourceId. + */ + public static ResourceId fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceId deserializedResourceId = new ResourceId(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedResourceId.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceId; + }); + } +} 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 000000000000..ced08ab5d0f6 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ResourceProperties.java @@ -0,0 +1,119 @@ +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Base for resource properties. + */ +@Immutable +public class ResourceProperties implements JsonSerializable { + /* + * Provisioning state of the ManagedNetwork resource. + */ + private ProvisioningState provisioningState; + + /* + * A unique read-only string that changes whenever the resource is updated. + */ + private String etag; + + /** + * Creates an instance of ResourceProperties class. + */ + public ResourceProperties() { + } + + /** + * Get the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Provisioning state of the ManagedNetwork resource. + * + * @param provisioningState the provisioningState value to set. + * @return the ResourceProperties object itself. + */ + ResourceProperties withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * 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; + } + + /** + * Set the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @param etag the etag value to set. + * @return the ResourceProperties object itself. + */ + ResourceProperties withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceProperties. + */ + public static ResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceProperties deserializedResourceProperties = new ResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedResourceProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else if ("etag".equals(fieldName)) { + deserializedResourceProperties.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceProperties; + }); + } +} 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 000000000000..78eb7bdd7c80 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Scope.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Scope of a Managed Network. + */ +@Fluent +public final class Scope implements JsonSerializable { + /* + * The collection of management groups covered by the Managed Network + */ + private List managementGroups; + + /* + * The collection of subscriptions covered by the Managed Network + */ + private List subscriptions; + + /* + * The collection of virtual nets covered by the Managed Network + */ + private List virtualNetworks; + + /* + * The collection of subnets covered by the Managed Network + */ + private List subnets; + + /** + * Creates an instance of Scope class. + */ + public Scope() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("managementGroups", this.managementGroups, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("subscriptions", this.subscriptions, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("virtualNetworks", this.virtualNetworks, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("subnets", this.subnets, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Scope from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Scope if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Scope. + */ + public static Scope fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Scope deserializedScope = new Scope(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("managementGroups".equals(fieldName)) { + List managementGroups = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedScope.managementGroups = managementGroups; + } else if ("subscriptions".equals(fieldName)) { + List subscriptions = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedScope.subscriptions = subscriptions; + } else if ("virtualNetworks".equals(fieldName)) { + List virtualNetworks = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedScope.virtualNetworks = virtualNetworks; + } else if ("subnets".equals(fieldName)) { + List subnets = reader.readArray(reader1 -> ResourceId.fromJson(reader1)); + deserializedScope.subnets = subnets; + } else { + reader.skipChildren(); + } + } + + return deserializedScope; + }); + } +} 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 000000000000..1de5795feb3a --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignment.java @@ -0,0 +1,233 @@ +// 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 000000000000..1d9358b1442e --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignmentListResult.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managednetwork.fluent.models.ScopeAssignmentInner; +import java.io.IOException; +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 implements JsonSerializable { + /* + * Gets a page of ScopeAssignment + */ + private List value; + + /* + * Gets the URL to get the next set of results. + */ + private String nextLink; + + /** + * Creates an instance of ScopeAssignmentListResult class. + */ + public ScopeAssignmentListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScopeAssignmentListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScopeAssignmentListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ScopeAssignmentListResult. + */ + public static ScopeAssignmentListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScopeAssignmentListResult deserializedScopeAssignmentListResult = new ScopeAssignmentListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ScopeAssignmentInner.fromJson(reader1)); + deserializedScopeAssignmentListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedScopeAssignmentListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedScopeAssignmentListResult; + }); + } +} 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 000000000000..342db39d05b6 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/ScopeAssignments.java @@ -0,0 +1,139 @@ +// 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. + * @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); + + /** + * 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); + + /** + * 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 deleteByResourceGroupWithResponse(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); + + /** + * 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 000000000000..064d741f701b --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/Type.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managednetwork.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Gets or sets the connectivity type of a network structure policy. + */ +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 a new instance of Type value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Type() { + } + + /** + * Creates or finds a Type from its string representation. + * + * @param name a name to look for. + * @return the corresponding Type. + */ + public static Type fromString(String name) { + return fromString(name, Type.class); + } + + /** + * Gets known Type values. + * + * @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 000000000000..16aa4685b5f7 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/models/package-info.java @@ -0,0 +1,11 @@ +// 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 000000000000..c2af99ca0208 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/com/azure/resourcemanager/managednetwork/package-info.java @@ -0,0 +1,11 @@ +// 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 000000000000..e859edfb4557 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/java/module-info.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.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; + opens com.azure.resourcemanager.managednetwork.models to com.azure.core; +} diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managednetwork/proxy-config.json b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managednetwork/proxy-config.json new file mode 100644 index 000000000000..d1e466c3f571 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managednetwork/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.managednetwork.implementation.ManagedNetworkGroupsClientImpl$ManagedNetworkGroupsService"],["com.azure.resourcemanager.managednetwork.implementation.ManagedNetworkPeeringPoliciesClientImpl$ManagedNetworkPeeringPoliciesService"],["com.azure.resourcemanager.managednetwork.implementation.ManagedNetworksClientImpl$ManagedNetworksService"],["com.azure.resourcemanager.managednetwork.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.managednetwork.implementation.ScopeAssignmentsClientImpl$ScopeAssignmentsService"]] \ No newline at end of file diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managednetwork/reflect-config.json b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managednetwork/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managednetwork/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/resources/azure-resourcemanager-managednetwork.properties b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/resources/azure-resourcemanager-managednetwork.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/main/resources/azure-resourcemanager-managednetwork.properties @@ -0,0 +1 @@ +version=${project.version} 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 000000000000..fe96faa80b52 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsCreateOrUpdateSamples.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.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 000000000000..930e10d53ef9 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsDeleteSamples.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 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", com.azure.core.util.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 000000000000..4112fe1de659 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsGetSamples.java @@ -0,0 +1,27 @@ +// 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 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", + com.azure.core.util.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 000000000000..f5cefd61e2d1 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkGroupsListByManagedNetworkSamples.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 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, com.azure.core.util.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 000000000000..8bf1ae393015 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesCreateOrUpdateSamples.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.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 000000000000..7259b596ca23 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesDeleteSamples.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 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", com.azure.core.util.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 000000000000..f07881adfff4 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesGetSamples.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 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", com.azure.core.util.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 000000000000..0ee922ef7c30 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworkPeeringPoliciesListByManagedNetworkSamples.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 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, com.azure.core.util.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 000000000000..e62ae7749b69 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksCreateOrUpdateSamples.java @@ -0,0 +1,63 @@ +// 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(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/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 000000000000..6b18063bd520 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksDeleteSamples.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; + +/** + * 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", com.azure.core.util.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 000000000000..633840210153 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksGetByResourceGroupSamples.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; + +/** + * 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", com.azure.core.util.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 000000000000..4724b997e02c --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksListByResourceGroupSamples.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; + +/** + * 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, com.azure.core.util.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 000000000000..e37a63427df3 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksListSamples.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; + +/** + * 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, com.azure.core.util.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 000000000000..13a9fe9f1e29 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ManagedNetworksUpdateSamples.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.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", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/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 000000000000..bb6429132c6a --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// 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 000000000000..6ad07405ef7e --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsDeleteSamples.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 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() + .deleteByResourceGroupWithResponse("subscriptions/subscriptionC", "subscriptionCAssignment", + com.azure.core.util.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 000000000000..951f11bceda4 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsGetSamples.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 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", + com.azure.core.util.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 000000000000..ecbc0a09d0c6 --- /dev/null +++ b/sdk/managednetwork/azure-resourcemanager-managednetwork/src/samples/java/com/azure/resourcemanager/managednetwork/generated/ScopeAssignmentsListSamples.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; + +/** + * 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", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managednetwork/ci.yml b/sdk/managednetwork/ci.yml new file mode 100644 index 000000000000..baf221bf4050 --- /dev/null +++ b/sdk/managednetwork/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/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 + +parameters: + - name: release_azureresourcemanagermanagednetwork + displayName: azure-resourcemanager-managednetwork + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: managednetwork + Artifacts: + - name: azure-resourcemanager-managednetwork + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermanagednetwork + releaseInBatch: ${{ parameters.release_azureresourcemanagermanagednetwork }} diff --git a/sdk/managednetwork/pom.xml b/sdk/managednetwork/pom.xml new file mode 100644 index 000000000000..5bcb12af0805 --- /dev/null +++ b/sdk/managednetwork/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-managednetwork-service + pom + 1.0.0 + + + azure-resourcemanager-managednetwork + +