diff --git a/eng/mgmt/mgmtmetadata/managednetwork.txt b/eng/mgmt/mgmtmetadata/managednetwork.txt new file mode 100644 index 0000000000000..603b183fb73d3 --- /dev/null +++ b/eng/mgmt/mgmtmetadata/managednetwork.txt @@ -0,0 +1,14 @@ +Installing AutoRest version: latest +AutoRest installed successfully. +Commencing code generation +Generating CSharp code +Executing AutoRest command +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/managednetwork/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=E:\wd\forkrepo\azure-sdk-for-net\sdk +2019-08-24 00:42:10 UTC +Azure-rest-api-specs repository information +GitHub fork: Azure +Branch: master +Commit: 8afd6663d145c938b80a9a9709aa2a9b101b3df2 +AutoRest information +Requested version: latest +Bootstrapper version: autorest@2.0.4283 diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/AzSdk.RP.props b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/AzSdk.RP.props new file mode 100644 index 0000000000000..e8e42bcb8fb70 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/AzSdk.RP.props @@ -0,0 +1,7 @@ + + + + ManagedNetwork_2019-06-01-preview; + $(PackageTags);$(CommonTags);$(AzureApiTag); + + \ No newline at end of file diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/Microsoft.Azure.Management.ManagedNetwork.sln b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/Microsoft.Azure.Management.ManagedNetwork.sln new file mode 100644 index 0000000000000..d1cb362ea8493 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/Microsoft.Azure.Management.ManagedNetwork.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.779 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Management.ManagedNetwork", "src\Microsoft.Azure.Management.ManagedNetwork.csproj", "{84555D52-26BF-4FBA-8E4E-983170275F2C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Management.ManagedNetwork.Tests", "tests\Microsoft.Azure.Management.ManagedNetwork.Tests.csproj", "{0BBAFF7A-75B6-465D-AE1E-52C6AA3C6284}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {84555D52-26BF-4FBA-8E4E-983170275F2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84555D52-26BF-4FBA-8E4E-983170275F2C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84555D52-26BF-4FBA-8E4E-983170275F2C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84555D52-26BF-4FBA-8E4E-983170275F2C}.Release|Any CPU.Build.0 = Release|Any CPU + {0BBAFF7A-75B6-465D-AE1E-52C6AA3C6284}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0BBAFF7A-75B6-465D-AE1E-52C6AA3C6284}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0BBAFF7A-75B6-465D-AE1E-52C6AA3C6284}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0BBAFF7A-75B6-465D-AE1E-52C6AA3C6284}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8AA755DD-3073-423C-A68F-F3BB8FA77871} + EndGlobalSection +EndGlobal diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/Microsoft.Azure.Management.ManagedNetwork.csproj b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/Microsoft.Azure.Management.ManagedNetwork.csproj new file mode 100644 index 0000000000000..d0f69abbc522a --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/Microsoft.Azure.Management.ManagedNetwork.csproj @@ -0,0 +1,24 @@ + + + + + + + Microsoft.Azure.Management.ManagedNetwork + Network Controller is a fully managed networking solution that allows customers to programmatically view, control, change, and monitor your entire Azure network centrally and with ease. + Microsoft.Azure.Management.ManagedNetwork + 1.0.0-preview + Microsoft Azure MangedNetwork management;ManagedNetwork;ManagedNetwork management; + + + + + $(SdkTargetFx) + + + + + + diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/Properties/AssemblyInfo.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000..4b67a646949fb --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/Properties/AssemblyInfo.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System.Reflection; +using System.Resources; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure ManagedNetwork Management Library")] +[assembly: AssemblyDescription("Provides Microsoft Azure ManagedNetwork management functions for managing the Microsoft Azure ManagedNetwork service.")] + +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Azure .NET SDK")] +[assembly: AssemblyCopyright("${AuthorCopyright}")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguage("en")] + diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generate.ps1 b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generate.ps1 new file mode 100644 index 0000000000000..4c3514b34dc34 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generate.ps1 @@ -0,0 +1 @@ +Start-AutoRestCodeGeneration -ResourceProvider "managednetwork" -AutoRestVersion "latest" \ No newline at end of file diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IManagedNetworkGroupsOperations.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IManagedNetworkGroupsOperations.cs new file mode 100644 index 0000000000000..831ec578badc5 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IManagedNetworkGroupsOperations.cs @@ -0,0 +1,238 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedNetworkGroupsOperations operations. + /// + public partial interface IManagedNetworkGroupsOperations + { + /// + /// The Get ManagedNetworkGroups operation gets a Managed Network Group + /// specified by the resource group, Managed Network name, and group + /// name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Put ManagedNetworkGroups operation creates or updates a Managed + /// Network Group resource + /// + /// + /// Parameters supplied to the create/update a Managed Network Group + /// resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(ManagedNetworkGroup managedNetworkGroup, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Delete ManagedNetworkGroups operation deletes a Managed Network + /// Group specified by the resource group, Managed Network name, and + /// group name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The ListByManagedNetwork ManagedNetworkGroup operation retrieves + /// all the Managed Network Groups in a specified Managed Networks in a + /// paginated format. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// May be used to limit the number of results in a page for list + /// queries. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagedNetworkWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Put ManagedNetworkGroups operation creates or updates a Managed + /// Network Group resource + /// + /// + /// Parameters supplied to the create/update a Managed Network Group + /// resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(ManagedNetworkGroup managedNetworkGroup, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Delete ManagedNetworkGroups operation deletes a Managed Network + /// Group specified by the resource group, Managed Network name, and + /// group name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The ListByManagedNetwork ManagedNetworkGroup operation retrieves + /// all the Managed Network Groups in a specified Managed Networks in a + /// paginated format. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagedNetworkNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IManagedNetworkManagementClient.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IManagedNetworkManagementClient.cs new file mode 100644 index 0000000000000..ce7407810e3ec --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IManagedNetworkManagementClient.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// 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 partial interface IManagedNetworkManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// Client Api Version. + /// + string ApiVersion { get; } + + /// + /// Gets subscription credentials which uniquely identify Microsoft + /// Azure subscription. The subscription ID forms part of the URI for + /// every service call. + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IManagedNetworksOperations. + /// + IManagedNetworksOperations ManagedNetworks { get; } + + /// + /// Gets the IScopeAssignmentsOperations. + /// + IScopeAssignmentsOperations ScopeAssignments { get; } + + /// + /// Gets the IManagedNetworkGroupsOperations. + /// + IManagedNetworkGroupsOperations ManagedNetworkGroups { get; } + + /// + /// Gets the IManagedNetworkPeeringPoliciesOperations. + /// + IManagedNetworkPeeringPoliciesOperations ManagedNetworkPeeringPolicies { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IManagedNetworkPeeringPoliciesOperations.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IManagedNetworkPeeringPoliciesOperations.cs new file mode 100644 index 0000000000000..b96d375fe93ba --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IManagedNetworkPeeringPoliciesOperations.cs @@ -0,0 +1,238 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedNetworkPeeringPoliciesOperations operations. + /// + public partial interface IManagedNetworkPeeringPoliciesOperations + { + /// + /// The Get ManagedNetworkPeeringPolicies operation gets a Managed + /// Network Peering Policy resource, specified by the resource group, + /// Managed Network name, and peering policy name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Put ManagedNetworkPeeringPolicies operation creates/updates a + /// new Managed Network Peering Policy + /// + /// + /// Parameters supplied to create/update a Managed Network Peering + /// Policy + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(ManagedNetworkPeeringPolicy managedNetworkPolicy, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Delete ManagedNetworkPeeringPolicies operation deletes a + /// Managed Network Peering Policy, specified by the resource group, + /// Managed Network name, and peering policy name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The ListByManagedNetwork PeeringPolicies operation retrieves all + /// the Managed Network Peering Policies in a specified Managed + /// Network, in a paginated format. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// May be used to limit the number of results in a page for list + /// queries. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagedNetworkWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Put ManagedNetworkPeeringPolicies operation creates/updates a + /// new Managed Network Peering Policy + /// + /// + /// Parameters supplied to create/update a Managed Network Peering + /// Policy + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(ManagedNetworkPeeringPolicy managedNetworkPolicy, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Delete ManagedNetworkPeeringPolicies operation deletes a + /// Managed Network Peering Policy, specified by the resource group, + /// Managed Network name, and peering policy name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The ListByManagedNetwork PeeringPolicies operation retrieves all + /// the Managed Network Peering Policies in a specified Managed + /// Network, in a paginated format. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagedNetworkNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IManagedNetworksOperations.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IManagedNetworksOperations.cs new file mode 100644 index 0000000000000..6161e866f7c84 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IManagedNetworksOperations.cs @@ -0,0 +1,299 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedNetworksOperations operations. + /// + public partial interface IManagedNetworksOperations + { + /// + /// The Get ManagedNetworks operation gets a Managed Network Resource, + /// specified by the resource group and Managed Network name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Put ManagedNetworks operation creates/updates a Managed Network + /// Resource, specified by resource group and Managed Network name + /// + /// + /// Parameters supplied to the create/update a Managed Network Resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(ManagedNetworkModel managedNetwork, string resourceGroupName, string managedNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Delete ManagedNetworks operation deletes a Managed Network + /// Resource, specified by the resource group and Managed Network name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the specified Managed Network resource tags. + /// + /// + /// Parameters supplied to update application gateway tags and/or + /// scope. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(ManagedNetworkUpdate parameters, string resourceGroupName, string managedNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The ListByResourceGroup ManagedNetwork operation retrieves all the + /// Managed Network resources in a resource group in a paginated + /// format. + /// + /// + /// The name of the resource group. + /// + /// + /// May be used to limit the number of results in a page for list + /// queries. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The ListBySubscription ManagedNetwork operation retrieves all the + /// Managed Network Resources in the current subscription in a + /// paginated format. + /// + /// + /// May be used to limit the number of results in a page for list + /// queries. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Delete ManagedNetworks operation deletes a Managed Network + /// Resource, specified by the resource group and Managed Network name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the specified Managed Network resource tags. + /// + /// + /// Parameters supplied to update application gateway tags and/or + /// scope. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(ManagedNetworkUpdate parameters, string resourceGroupName, string managedNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The ListByResourceGroup ManagedNetwork operation retrieves all the + /// Managed Network resources in a resource group in a paginated + /// format. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The ListBySubscription ManagedNetwork operation retrieves all the + /// Managed Network Resources in the current subscription in a + /// paginated format. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IOperations.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IOperations.cs new file mode 100644 index 0000000000000..908968c102f8a --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IOperations.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists all of the available MNC operations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the available MNC operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IScopeAssignmentsOperations.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IScopeAssignmentsOperations.cs new file mode 100644 index 0000000000000..64c9754f8b1e1 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/IScopeAssignmentsOperations.cs @@ -0,0 +1,153 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ScopeAssignmentsOperations operations. + /// + public partial interface IScopeAssignmentsOperations + { + /// + /// Get the specified scope assignment. + /// + /// + /// The base resource of the scope assignment. + /// + /// + /// The name of the scope assignment to get. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string scope, string scopeAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a scope assignment. + /// + /// + /// Parameters supplied to the specify which Managed Network this scope + /// is being assigned + /// + /// + /// 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. + /// + /// + /// The name of the scope assignment to create. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(ScopeAssignment parameters, string scope, string scopeAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a scope assignment. + /// + /// + /// The scope of the scope assignment to delete. + /// + /// + /// The name of the scope assignment to delete. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string scope, string scopeAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the specified scope assignment. + /// + /// + /// The base resource of the scope assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the specified scope assignment. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkGroupsOperations.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkGroupsOperations.cs new file mode 100644 index 0000000000000..d2762c47afe91 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkGroupsOperations.cs @@ -0,0 +1,1113 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedNetworkGroupsOperations operations. + /// + internal partial class ManagedNetworkGroupsOperations : IServiceOperations, IManagedNetworkGroupsOperations + { + /// + /// Initializes a new instance of the ManagedNetworkGroupsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedNetworkGroupsOperations(ManagedNetworkManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ManagedNetworkManagementClient + /// + public ManagedNetworkManagementClient Client { get; private set; } + + /// + /// The Get ManagedNetworkGroups operation gets a Managed Network Group + /// specified by the resource group, Managed Network name, and group name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkName"); + } + if (managedNetworkGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkGroupName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedNetworkName", managedNetworkName); + tracingParameters.Add("managedNetworkGroupName", managedNetworkGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkGroups/{managedNetworkGroupName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedNetworkName}", System.Uri.EscapeDataString(managedNetworkName)); + _url = _url.Replace("{managedNetworkGroupName}", System.Uri.EscapeDataString(managedNetworkGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Put ManagedNetworkGroups operation creates or updates a Managed Network + /// Group resource + /// + /// + /// Parameters supplied to the create/update a Managed Network Group resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(ManagedNetworkGroup managedNetworkGroup, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(managedNetworkGroup, resourceGroupName, managedNetworkName, managedNetworkGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The Delete ManagedNetworkGroups operation deletes a Managed Network Group + /// specified by the resource group, Managed Network name, and group name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the + /// Managed Network Groups in a specified Managed Networks in a paginated + /// format. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedNetworkWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkName"); + } + if (top > 20) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "top", 20); + } + if (top < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedNetworkName", managedNetworkName); + tracingParameters.Add("top", top); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedNetwork", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkGroups").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedNetworkName}", System.Uri.EscapeDataString(managedNetworkName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Put ManagedNetworkGroups operation creates or updates a Managed Network + /// Group resource + /// + /// + /// Parameters supplied to the create/update a Managed Network Group resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(ManagedNetworkGroup managedNetworkGroup, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (managedNetworkGroup == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkGroup"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkName"); + } + if (managedNetworkGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkGroupName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("managedNetworkGroup", managedNetworkGroup); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedNetworkName", managedNetworkName); + tracingParameters.Add("managedNetworkGroupName", managedNetworkGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkGroups/{managedNetworkGroupName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedNetworkName}", System.Uri.EscapeDataString(managedNetworkName)); + _url = _url.Replace("{managedNetworkGroupName}", System.Uri.EscapeDataString(managedNetworkGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(managedNetworkGroup != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(managedNetworkGroup, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Delete ManagedNetworkGroups operation deletes a Managed Network Group + /// specified by the resource group, Managed Network name, and group name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkName"); + } + if (managedNetworkGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkGroupName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedNetworkName", managedNetworkName); + tracingParameters.Add("managedNetworkGroupName", managedNetworkGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkGroups/{managedNetworkGroupName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedNetworkName}", System.Uri.EscapeDataString(managedNetworkName)); + _url = _url.Replace("{managedNetworkGroupName}", System.Uri.EscapeDataString(managedNetworkGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the + /// Managed Network Groups in a specified Managed Networks in a paginated + /// format. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedNetworkNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedNetworkNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkGroupsOperationsExtensions.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkGroupsOperationsExtensions.cs new file mode 100644 index 0000000000000..e60304adace47 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkGroupsOperationsExtensions.cs @@ -0,0 +1,371 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedNetworkGroupsOperations. + /// + public static partial class ManagedNetworkGroupsOperationsExtensions + { + /// + /// The Get ManagedNetworkGroups operation gets a Managed Network Group + /// specified by the resource group, Managed Network name, and group name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + public static ManagedNetworkGroup Get(this IManagedNetworkGroupsOperations operations, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName) + { + return operations.GetAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName).GetAwaiter().GetResult(); + } + + /// + /// The Get ManagedNetworkGroups operation gets a Managed Network Group + /// specified by the resource group, Managed Network name, and group name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedNetworkGroupsOperations operations, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The Put ManagedNetworkGroups operation creates or updates a Managed Network + /// Group resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the create/update a Managed Network Group resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + public static ManagedNetworkGroup CreateOrUpdate(this IManagedNetworkGroupsOperations operations, ManagedNetworkGroup managedNetworkGroup, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName) + { + return operations.CreateOrUpdateAsync(managedNetworkGroup, resourceGroupName, managedNetworkName, managedNetworkGroupName).GetAwaiter().GetResult(); + } + + /// + /// The Put ManagedNetworkGroups operation creates or updates a Managed Network + /// Group resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the create/update a Managed Network Group resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagedNetworkGroupsOperations operations, ManagedNetworkGroup managedNetworkGroup, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(managedNetworkGroup, resourceGroupName, managedNetworkName, managedNetworkGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The Delete ManagedNetworkGroups operation deletes a Managed Network Group + /// specified by the resource group, Managed Network name, and group name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + public static void Delete(this IManagedNetworkGroupsOperations operations, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName) + { + operations.DeleteAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName).GetAwaiter().GetResult(); + } + + /// + /// The Delete ManagedNetworkGroups operation deletes a Managed Network Group + /// specified by the resource group, Managed Network name, and group name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IManagedNetworkGroupsOperations operations, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the + /// Managed Network Groups in a specified Managed Networks in a paginated + /// format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// + /// + /// 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. + /// + public static IPage ListByManagedNetwork(this IManagedNetworkGroupsOperations operations, string resourceGroupName, string managedNetworkName, int? top = default(int?), string skiptoken = default(string)) + { + return operations.ListByManagedNetworkAsync(resourceGroupName, managedNetworkName, top, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the + /// Managed Network Groups in a specified Managed Networks in a paginated + /// format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedNetworkAsync(this IManagedNetworkGroupsOperations operations, string resourceGroupName, string managedNetworkName, int? top = default(int?), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedNetworkWithHttpMessagesAsync(resourceGroupName, managedNetworkName, top, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The Put ManagedNetworkGroups operation creates or updates a Managed Network + /// Group resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the create/update a Managed Network Group resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + public static ManagedNetworkGroup BeginCreateOrUpdate(this IManagedNetworkGroupsOperations operations, ManagedNetworkGroup managedNetworkGroup, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName) + { + return operations.BeginCreateOrUpdateAsync(managedNetworkGroup, resourceGroupName, managedNetworkName, managedNetworkGroupName).GetAwaiter().GetResult(); + } + + /// + /// The Put ManagedNetworkGroups operation creates or updates a Managed Network + /// Group resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the create/update a Managed Network Group resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IManagedNetworkGroupsOperations operations, ManagedNetworkGroup managedNetworkGroup, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(managedNetworkGroup, resourceGroupName, managedNetworkName, managedNetworkGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The Delete ManagedNetworkGroups operation deletes a Managed Network Group + /// specified by the resource group, Managed Network name, and group name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + public static void BeginDelete(this IManagedNetworkGroupsOperations operations, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName) + { + operations.BeginDeleteAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName).GetAwaiter().GetResult(); + } + + /// + /// The Delete ManagedNetworkGroups operation deletes a Managed Network Group + /// specified by the resource group, Managed Network name, and group name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Group. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IManagedNetworkGroupsOperations operations, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedNetworkName, managedNetworkGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the + /// Managed Network Groups in a specified Managed Networks in a paginated + /// format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByManagedNetworkNext(this IManagedNetworkGroupsOperations operations, string nextPageLink) + { + return operations.ListByManagedNetworkNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// The ListByManagedNetwork ManagedNetworkGroup operation retrieves all the + /// Managed Network Groups in a specified Managed Networks in a paginated + /// format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedNetworkNextAsync(this IManagedNetworkGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedNetworkNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkManagementClient.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkManagementClient.cs new file mode 100644 index 0000000000000..3d44a8c8b39c3 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkManagementClient.cs @@ -0,0 +1,389 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + /// + /// 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 partial class ManagedNetworkManagementClient : ServiceClient, IManagedNetworkManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Client Api Version. + /// + public string ApiVersion { get; private set; } + + /// + /// Gets subscription credentials which uniquely identify Microsoft Azure + /// subscription. The subscription ID forms part of the URI for every service + /// call. + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IManagedNetworksOperations. + /// + public virtual IManagedNetworksOperations ManagedNetworks { get; private set; } + + /// + /// Gets the IScopeAssignmentsOperations. + /// + public virtual IScopeAssignmentsOperations ScopeAssignments { get; private set; } + + /// + /// Gets the IManagedNetworkGroupsOperations. + /// + public virtual IManagedNetworkGroupsOperations ManagedNetworkGroups { get; private set; } + + /// + /// Gets the IManagedNetworkPeeringPoliciesOperations. + /// + public virtual IManagedNetworkPeeringPoliciesOperations ManagedNetworkPeeringPolicies { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Initializes a new instance of the ManagedNetworkManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ManagedNetworkManagementClient.Dispose(). False: will not dispose provided httpClient + protected ManagedNetworkManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ManagedNetworkManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected ManagedNetworkManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ManagedNetworkManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected ManagedNetworkManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ManagedNetworkManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected ManagedNetworkManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the ManagedNetworkManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected ManagedNetworkManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the ManagedNetworkManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ManagedNetworkManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ManagedNetworkManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ManagedNetworkManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public ManagedNetworkManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ManagedNetworkManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ManagedNetworkManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ManagedNetworkManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ManagedNetworkManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ManagedNetworkManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ManagedNetworkManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + ManagedNetworks = new ManagedNetworksOperations(this); + ScopeAssignments = new ScopeAssignmentsOperations(this); + ManagedNetworkGroups = new ManagedNetworkGroupsOperations(this); + ManagedNetworkPeeringPolicies = new ManagedNetworkPeeringPoliciesOperations(this); + Operations = new Operations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2019-06-01-preview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkPeeringPoliciesOperations.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkPeeringPoliciesOperations.cs new file mode 100644 index 0000000000000..702a35cb7a0d2 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkPeeringPoliciesOperations.cs @@ -0,0 +1,1120 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedNetworkPeeringPoliciesOperations operations. + /// + internal partial class ManagedNetworkPeeringPoliciesOperations : IServiceOperations, IManagedNetworkPeeringPoliciesOperations + { + /// + /// Initializes a new instance of the ManagedNetworkPeeringPoliciesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedNetworkPeeringPoliciesOperations(ManagedNetworkManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ManagedNetworkManagementClient + /// + public ManagedNetworkManagementClient Client { get; private set; } + + /// + /// The Get ManagedNetworkPeeringPolicies operation gets a Managed Network + /// Peering Policy resource, specified by the resource group, Managed Network + /// name, and peering policy name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkName"); + } + if (managedNetworkPeeringPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkPeeringPolicyName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedNetworkName", managedNetworkName); + tracingParameters.Add("managedNetworkPeeringPolicyName", managedNetworkPeeringPolicyName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies/{managedNetworkPeeringPolicyName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedNetworkName}", System.Uri.EscapeDataString(managedNetworkName)); + _url = _url.Replace("{managedNetworkPeeringPolicyName}", System.Uri.EscapeDataString(managedNetworkPeeringPolicyName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Put ManagedNetworkPeeringPolicies operation creates/updates a new + /// Managed Network Peering Policy + /// + /// + /// Parameters supplied to create/update a Managed Network Peering Policy + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(ManagedNetworkPeeringPolicy managedNetworkPolicy, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(managedNetworkPolicy, resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The Delete ManagedNetworkPeeringPolicies operation deletes a Managed + /// Network Peering Policy, specified by the resource group, Managed Network + /// name, and peering policy name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The ListByManagedNetwork PeeringPolicies operation retrieves all the + /// Managed Network Peering Policies in a specified Managed Network, in a + /// paginated format. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedNetworkWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkName"); + } + if (top > 20) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "top", 20); + } + if (top < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedNetworkName", managedNetworkName); + tracingParameters.Add("top", top); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedNetwork", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedNetworkName}", System.Uri.EscapeDataString(managedNetworkName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Put ManagedNetworkPeeringPolicies operation creates/updates a new + /// Managed Network Peering Policy + /// + /// + /// Parameters supplied to create/update a Managed Network Peering Policy + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(ManagedNetworkPeeringPolicy managedNetworkPolicy, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (managedNetworkPolicy == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkPolicy"); + } + if (managedNetworkPolicy != null) + { + managedNetworkPolicy.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkName"); + } + if (managedNetworkPeeringPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkPeeringPolicyName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("managedNetworkPolicy", managedNetworkPolicy); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedNetworkName", managedNetworkName); + tracingParameters.Add("managedNetworkPeeringPolicyName", managedNetworkPeeringPolicyName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies/{managedNetworkPeeringPolicyName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedNetworkName}", System.Uri.EscapeDataString(managedNetworkName)); + _url = _url.Replace("{managedNetworkPeeringPolicyName}", System.Uri.EscapeDataString(managedNetworkPeeringPolicyName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(managedNetworkPolicy != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(managedNetworkPolicy, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Delete ManagedNetworkPeeringPolicies operation deletes a Managed + /// Network Peering Policy, specified by the resource group, Managed Network + /// name, and peering policy name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkName"); + } + if (managedNetworkPeeringPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkPeeringPolicyName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedNetworkName", managedNetworkName); + tracingParameters.Add("managedNetworkPeeringPolicyName", managedNetworkPeeringPolicyName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies/{managedNetworkPeeringPolicyName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedNetworkName}", System.Uri.EscapeDataString(managedNetworkName)); + _url = _url.Replace("{managedNetworkPeeringPolicyName}", System.Uri.EscapeDataString(managedNetworkPeeringPolicyName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The ListByManagedNetwork PeeringPolicies operation retrieves all the + /// Managed Network Peering Policies in a specified Managed Network, in a + /// paginated format. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedNetworkNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedNetworkNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkPeeringPoliciesOperationsExtensions.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkPeeringPoliciesOperationsExtensions.cs new file mode 100644 index 0000000000000..450bceb07ded4 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworkPeeringPoliciesOperationsExtensions.cs @@ -0,0 +1,377 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedNetworkPeeringPoliciesOperations. + /// + public static partial class ManagedNetworkPeeringPoliciesOperationsExtensions + { + /// + /// The Get ManagedNetworkPeeringPolicies operation gets a Managed Network + /// Peering Policy resource, specified by the resource group, Managed Network + /// name, and peering policy name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + public static ManagedNetworkPeeringPolicy Get(this IManagedNetworkPeeringPoliciesOperations operations, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName) + { + return operations.GetAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName).GetAwaiter().GetResult(); + } + + /// + /// The Get ManagedNetworkPeeringPolicies operation gets a Managed Network + /// Peering Policy resource, specified by the resource group, Managed Network + /// name, and peering policy name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedNetworkPeeringPoliciesOperations operations, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The Put ManagedNetworkPeeringPolicies operation creates/updates a new + /// Managed Network Peering Policy + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to create/update a Managed Network Peering Policy + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + public static ManagedNetworkPeeringPolicy CreateOrUpdate(this IManagedNetworkPeeringPoliciesOperations operations, ManagedNetworkPeeringPolicy managedNetworkPolicy, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName) + { + return operations.CreateOrUpdateAsync(managedNetworkPolicy, resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName).GetAwaiter().GetResult(); + } + + /// + /// The Put ManagedNetworkPeeringPolicies operation creates/updates a new + /// Managed Network Peering Policy + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to create/update a Managed Network Peering Policy + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagedNetworkPeeringPoliciesOperations operations, ManagedNetworkPeeringPolicy managedNetworkPolicy, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(managedNetworkPolicy, resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The Delete ManagedNetworkPeeringPolicies operation deletes a Managed + /// Network Peering Policy, specified by the resource group, Managed Network + /// name, and peering policy name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + public static void Delete(this IManagedNetworkPeeringPoliciesOperations operations, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName) + { + operations.DeleteAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName).GetAwaiter().GetResult(); + } + + /// + /// The Delete ManagedNetworkPeeringPolicies operation deletes a Managed + /// Network Peering Policy, specified by the resource group, Managed Network + /// name, and peering policy name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IManagedNetworkPeeringPoliciesOperations operations, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The ListByManagedNetwork PeeringPolicies operation retrieves all the + /// Managed Network Peering Policies in a specified Managed Network, in a + /// paginated format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// + /// + /// 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. + /// + public static IPage ListByManagedNetwork(this IManagedNetworkPeeringPoliciesOperations operations, string resourceGroupName, string managedNetworkName, int? top = default(int?), string skiptoken = default(string)) + { + return operations.ListByManagedNetworkAsync(resourceGroupName, managedNetworkName, top, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// The ListByManagedNetwork PeeringPolicies operation retrieves all the + /// Managed Network Peering Policies in a specified Managed Network, in a + /// paginated format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedNetworkAsync(this IManagedNetworkPeeringPoliciesOperations operations, string resourceGroupName, string managedNetworkName, int? top = default(int?), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedNetworkWithHttpMessagesAsync(resourceGroupName, managedNetworkName, top, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The Put ManagedNetworkPeeringPolicies operation creates/updates a new + /// Managed Network Peering Policy + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to create/update a Managed Network Peering Policy + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + public static ManagedNetworkPeeringPolicy BeginCreateOrUpdate(this IManagedNetworkPeeringPoliciesOperations operations, ManagedNetworkPeeringPolicy managedNetworkPolicy, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName) + { + return operations.BeginCreateOrUpdateAsync(managedNetworkPolicy, resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName).GetAwaiter().GetResult(); + } + + /// + /// The Put ManagedNetworkPeeringPolicies operation creates/updates a new + /// Managed Network Peering Policy + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to create/update a Managed Network Peering Policy + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IManagedNetworkPeeringPoliciesOperations operations, ManagedNetworkPeeringPolicy managedNetworkPolicy, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(managedNetworkPolicy, resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The Delete ManagedNetworkPeeringPolicies operation deletes a Managed + /// Network Peering Policy, specified by the resource group, Managed Network + /// name, and peering policy name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + public static void BeginDelete(this IManagedNetworkPeeringPoliciesOperations operations, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName) + { + operations.BeginDeleteAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName).GetAwaiter().GetResult(); + } + + /// + /// The Delete ManagedNetworkPeeringPolicies operation deletes a Managed + /// Network Peering Policy, specified by the resource group, Managed Network + /// name, and peering policy name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The name of the Managed Network Peering Policy. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IManagedNetworkPeeringPoliciesOperations operations, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedNetworkName, managedNetworkPeeringPolicyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The ListByManagedNetwork PeeringPolicies operation retrieves all the + /// Managed Network Peering Policies in a specified Managed Network, in a + /// paginated format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByManagedNetworkNext(this IManagedNetworkPeeringPoliciesOperations operations, string nextPageLink) + { + return operations.ListByManagedNetworkNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// The ListByManagedNetwork PeeringPolicies operation retrieves all the + /// Managed Network Peering Policies in a specified Managed Network, in a + /// paginated format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedNetworkNextAsync(this IManagedNetworkPeeringPoliciesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedNetworkNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworksOperations.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworksOperations.cs new file mode 100644 index 0000000000000..25ad8e9270848 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworksOperations.cs @@ -0,0 +1,1665 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedNetworksOperations operations. + /// + internal partial class ManagedNetworksOperations : IServiceOperations, IManagedNetworksOperations + { + /// + /// Initializes a new instance of the ManagedNetworksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedNetworksOperations(ManagedNetworkManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ManagedNetworkManagementClient + /// + public ManagedNetworkManagementClient Client { get; private set; } + + /// + /// The Get ManagedNetworks operation gets a Managed Network Resource, + /// specified by the resource group and Managed Network name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedNetworkName", managedNetworkName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedNetworkName}", System.Uri.EscapeDataString(managedNetworkName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Put ManagedNetworks operation creates/updates a Managed Network + /// Resource, specified by resource group and Managed Network name + /// + /// + /// Parameters supplied to the create/update a Managed Network Resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(ManagedNetworkModel managedNetwork, string resourceGroupName, string managedNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (managedNetwork == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetwork"); + } + if (managedNetwork != null) + { + managedNetwork.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("managedNetwork", managedNetwork); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedNetworkName", managedNetworkName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedNetworkName}", System.Uri.EscapeDataString(managedNetworkName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(managedNetwork != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(managedNetwork, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Delete ManagedNetworks operation deletes a Managed Network Resource, + /// specified by the resource group and Managed Network name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedNetworkName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates the specified Managed Network resource tags. + /// + /// + /// Parameters supplied to update application gateway tags and/or scope. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(ManagedNetworkUpdate parameters, string resourceGroupName, string managedNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(parameters, resourceGroupName, managedNetworkName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The ListByResourceGroup ManagedNetwork operation retrieves all the Managed + /// Network resources in a resource group in a paginated format. + /// + /// + /// The name of the resource group. + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (top > 20) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "top", 20); + } + if (top < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("top", top); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The ListBySubscription ManagedNetwork operation retrieves all the Managed + /// Network Resources in the current subscription in a paginated format. + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (top > 20) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "top", 20); + } + if (top < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("top", top); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetwork/managedNetworks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Delete ManagedNetworks operation deletes a Managed Network Resource, + /// specified by the resource group and Managed Network name + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedNetworkName", managedNetworkName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedNetworkName}", System.Uri.EscapeDataString(managedNetworkName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the specified Managed Network resource tags. + /// + /// + /// Parameters supplied to update application gateway tags and/or scope. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(ManagedNetworkUpdate parameters, string resourceGroupName, string managedNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedNetworkName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedNetworkName", managedNetworkName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedNetworkName}", System.Uri.EscapeDataString(managedNetworkName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The ListByResourceGroup ManagedNetwork operation retrieves all the Managed + /// Network resources in a resource group in a paginated format. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The ListBySubscription ManagedNetwork operation retrieves all the Managed + /// Network Resources in the current subscription in a paginated format. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworksOperationsExtensions.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworksOperationsExtensions.cs new file mode 100644 index 0000000000000..1d68b81c22961 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ManagedNetworksOperationsExtensions.cs @@ -0,0 +1,459 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedNetworksOperations. + /// + public static partial class ManagedNetworksOperationsExtensions + { + /// + /// The Get ManagedNetworks operation gets a Managed Network Resource, + /// specified by the resource group and Managed Network name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + public static ManagedNetworkModel Get(this IManagedNetworksOperations operations, string resourceGroupName, string managedNetworkName) + { + return operations.GetAsync(resourceGroupName, managedNetworkName).GetAwaiter().GetResult(); + } + + /// + /// The Get ManagedNetworks operation gets a Managed Network Resource, + /// specified by the resource group and Managed Network name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedNetworksOperations operations, string resourceGroupName, string managedNetworkName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedNetworkName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The Put ManagedNetworks operation creates/updates a Managed Network + /// Resource, specified by resource group and Managed Network name + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the create/update a Managed Network Resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + public static ManagedNetworkModel CreateOrUpdate(this IManagedNetworksOperations operations, ManagedNetworkModel managedNetwork, string resourceGroupName, string managedNetworkName) + { + return operations.CreateOrUpdateAsync(managedNetwork, resourceGroupName, managedNetworkName).GetAwaiter().GetResult(); + } + + /// + /// The Put ManagedNetworks operation creates/updates a Managed Network + /// Resource, specified by resource group and Managed Network name + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the create/update a Managed Network Resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagedNetworksOperations operations, ManagedNetworkModel managedNetwork, string resourceGroupName, string managedNetworkName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(managedNetwork, resourceGroupName, managedNetworkName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The Delete ManagedNetworks operation deletes a Managed Network Resource, + /// specified by the resource group and Managed Network name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + public static void Delete(this IManagedNetworksOperations operations, string resourceGroupName, string managedNetworkName) + { + operations.DeleteAsync(resourceGroupName, managedNetworkName).GetAwaiter().GetResult(); + } + + /// + /// The Delete ManagedNetworks operation deletes a Managed Network Resource, + /// specified by the resource group and Managed Network name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IManagedNetworksOperations operations, string resourceGroupName, string managedNetworkName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, managedNetworkName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates the specified Managed Network resource tags. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to update application gateway tags and/or scope. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + public static ManagedNetworkModel Update(this IManagedNetworksOperations operations, ManagedNetworkUpdate parameters, string resourceGroupName, string managedNetworkName) + { + return operations.UpdateAsync(parameters, resourceGroupName, managedNetworkName).GetAwaiter().GetResult(); + } + + /// + /// Updates the specified Managed Network resource tags. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to update application gateway tags and/or scope. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IManagedNetworksOperations operations, ManagedNetworkUpdate parameters, string resourceGroupName, string managedNetworkName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(parameters, resourceGroupName, managedNetworkName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The ListByResourceGroup ManagedNetwork operation retrieves all the Managed + /// Network resources in a resource group in a paginated format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// + /// + /// 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. + /// + public static IPage ListByResourceGroup(this IManagedNetworksOperations operations, string resourceGroupName, int? top = default(int?), string skiptoken = default(string)) + { + return operations.ListByResourceGroupAsync(resourceGroupName, top, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// The ListByResourceGroup ManagedNetwork operation retrieves all the Managed + /// Network resources in a resource group in a paginated format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IManagedNetworksOperations operations, string resourceGroupName, int? top = default(int?), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, top, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The ListBySubscription ManagedNetwork operation retrieves all the Managed + /// Network Resources in the current subscription in a paginated format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// + /// + /// 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. + /// + public static IPage ListBySubscription(this IManagedNetworksOperations operations, int? top = default(int?), string skiptoken = default(string)) + { + return operations.ListBySubscriptionAsync(top, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// The ListBySubscription ManagedNetwork operation retrieves all the Managed + /// Network Resources in the current subscription in a paginated format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IManagedNetworksOperations operations, int? top = default(int?), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(top, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The Delete ManagedNetworks operation deletes a Managed Network Resource, + /// specified by the resource group and Managed Network name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + public static void BeginDelete(this IManagedNetworksOperations operations, string resourceGroupName, string managedNetworkName) + { + operations.BeginDeleteAsync(resourceGroupName, managedNetworkName).GetAwaiter().GetResult(); + } + + /// + /// The Delete ManagedNetworks operation deletes a Managed Network Resource, + /// specified by the resource group and Managed Network name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IManagedNetworksOperations operations, string resourceGroupName, string managedNetworkName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedNetworkName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates the specified Managed Network resource tags. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to update application gateway tags and/or scope. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + public static ManagedNetworkModel BeginUpdate(this IManagedNetworksOperations operations, ManagedNetworkUpdate parameters, string resourceGroupName, string managedNetworkName) + { + return operations.BeginUpdateAsync(parameters, resourceGroupName, managedNetworkName).GetAwaiter().GetResult(); + } + + /// + /// Updates the specified Managed Network resource tags. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to update application gateway tags and/or scope. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Managed Network. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IManagedNetworksOperations operations, ManagedNetworkUpdate parameters, string resourceGroupName, string managedNetworkName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(parameters, resourceGroupName, managedNetworkName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The ListByResourceGroup ManagedNetwork operation retrieves all the Managed + /// Network resources in a resource group in a paginated format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IManagedNetworksOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// The ListByResourceGroup ManagedNetwork operation retrieves all the Managed + /// Network resources in a resource group in a paginated format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IManagedNetworksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The ListBySubscription ManagedNetwork operation retrieves all the Managed + /// Network Resources in the current subscription in a paginated format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IManagedNetworksOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// The ListBySubscription ManagedNetwork operation retrieves all the Managed + /// Network Resources in the current subscription in a paginated format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IManagedNetworksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ConnectivityCollection.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ConnectivityCollection.cs new file mode 100644 index 0000000000000..e4c9cab5f5848 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ConnectivityCollection.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The collection of Connectivity related groups and policies within the + /// Managed Network + /// + public partial class ConnectivityCollection + { + /// + /// Initializes a new instance of the ConnectivityCollection class. + /// + public ConnectivityCollection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConnectivityCollection class. + /// + /// The collection of connectivity related Managed + /// Network Groups within the Managed Network + /// The collection of Managed Network Peering + /// Policies within the Managed Network + public ConnectivityCollection(IList groups = default(IList), IList peerings = default(IList)) + { + Groups = groups; + Peerings = peerings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the collection of connectivity related Managed Network Groups + /// within the Managed Network + /// + [JsonProperty(PropertyName = "groups")] + public IList Groups { get; private set; } + + /// + /// Gets the collection of Managed Network Peering Policies within the + /// Managed Network + /// + [JsonProperty(PropertyName = "peerings")] + public IList Peerings { get; private set; } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ErrorResponse.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ErrorResponse.cs new file mode 100644 index 0000000000000..b233ee303a67e --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ErrorResponse.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The error response that indicates why an operation has failed. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error code. + /// The error message. + public ErrorResponse(string code = default(string), string message = default(string)) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ErrorResponseException.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ErrorResponseException.cs new file mode 100644 index 0000000000000..b7e627fbf2633 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/HubAndSpokePeeringPolicyProperties.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/HubAndSpokePeeringPolicyProperties.cs new file mode 100644 index 0000000000000..0703cb1859838 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/HubAndSpokePeeringPolicyProperties.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a Hub and Spoke Peering Policy + /// + public partial class HubAndSpokePeeringPolicyProperties : ManagedNetworkPeeringPolicyProperties + { + /// + /// Initializes a new instance of the + /// HubAndSpokePeeringPolicyProperties class. + /// + public HubAndSpokePeeringPolicyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// HubAndSpokePeeringPolicyProperties class. + /// + /// Gets or sets the connectivity type of a network + /// structure policy. Possible values include: 'HubAndSpokeTopology', + /// 'MeshTopology' + /// Provisioning state of the + /// ManagedNetwork resource. Possible values are: 'Updating', + /// 'Deleting', and 'Failed'. Possible values include: 'Updating', + /// 'Deleting', 'Failed', 'Succeeded' + /// A unique read-only string that changes whenever + /// the resource is updated. + /// Gets or sets the hub virtual network ID + /// Gets or sets the spokes group IDs + /// Gets or sets the mesh group IDs + public HubAndSpokePeeringPolicyProperties(string type, string provisioningState = default(string), string etag = default(string), ResourceId hub = default(ResourceId), IList spokes = default(IList), IList mesh = default(IList)) + : base(type, provisioningState, etag, hub, spokes, mesh) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Kind.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Kind.cs new file mode 100644 index 0000000000000..343f61a55f642 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Kind.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + + /// + /// Defines values for Kind. + /// + public static class Kind + { + public const string Connectivity = "Connectivity"; + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkGroup.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkGroup.cs new file mode 100644 index 0000000000000..c5a7972ebb49b --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkGroup.cs @@ -0,0 +1,129 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Managed Network Group resource + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedNetworkGroup : ProxyResource + { + /// + /// Initializes a new instance of the ManagedNetworkGroup class. + /// + public ManagedNetworkGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedNetworkGroup class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Provisioning state of the + /// ManagedNetwork resource. Possible values are: 'Updating', + /// 'Deleting', and 'Failed'. Possible values include: 'Updating', + /// 'Deleting', 'Failed', 'Succeeded' + /// A unique read-only string that changes whenever + /// the resource is updated. + /// The collection of management groups + /// covered by the Managed Network + /// The collection of subscriptions covered + /// by the Managed Network + /// The collection of virtual nets + /// covered by the Managed Network + /// The collection of subnets covered by the + /// Managed Network + /// Responsibility role under which this Managed + /// Network Group will be created. Possible values include: + /// 'Connectivity' + public ManagedNetworkGroup(string id = default(string), string name = default(string), string type = default(string), string provisioningState = default(string), string etag = default(string), IList managementGroups = default(IList), IList subscriptions = default(IList), IList virtualNetworks = default(IList), IList subnets = default(IList), string kind = default(string)) + : base(id, name, type) + { + ProvisioningState = provisioningState; + Etag = etag; + ManagementGroups = managementGroups; + Subscriptions = subscriptions; + VirtualNetworks = virtualNetworks; + Subnets = subnets; + Kind = kind; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets provisioning state of the ManagedNetwork resource. Possible + /// values are: 'Updating', 'Deleting', and 'Failed'. Possible values + /// include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "properties.etag")] + public string Etag { get; private set; } + + /// + /// Gets or sets the collection of management groups covered by the + /// Managed Network + /// + [JsonProperty(PropertyName = "properties.managementGroups")] + public IList ManagementGroups { get; set; } + + /// + /// Gets or sets the collection of subscriptions covered by the Managed + /// Network + /// + [JsonProperty(PropertyName = "properties.subscriptions")] + public IList Subscriptions { get; set; } + + /// + /// Gets or sets the collection of virtual nets covered by the Managed + /// Network + /// + [JsonProperty(PropertyName = "properties.virtualNetworks")] + public IList VirtualNetworks { get; set; } + + /// + /// Gets or sets the collection of subnets covered by the Managed + /// Network + /// + [JsonProperty(PropertyName = "properties.subnets")] + public IList Subnets { get; set; } + + /// + /// Gets or sets responsibility role under which this Managed Network + /// Group will be created. Possible values include: 'Connectivity' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkModel.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkModel.cs new file mode 100644 index 0000000000000..76f555a4cfb71 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkModel.cs @@ -0,0 +1,115 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Managed Network resource + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedNetworkModel : TrackedResource + { + /// + /// Initializes a new instance of the ManagedNetworkModel class. + /// + public ManagedNetworkModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedNetworkModel class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + /// Provisioning state of the + /// ManagedNetwork resource. Possible values are: 'Updating', + /// 'Deleting', and 'Failed'. Possible values include: 'Updating', + /// 'Deleting', 'Failed', 'Succeeded' + /// A unique read-only string that changes whenever + /// the resource is updated. + /// 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 + /// The collection of groups and policies + /// concerned with connectivity + public ManagedNetworkModel(string location, string id = default(string), string name = default(string), string type = default(string), IList tags = default(IList), string provisioningState = default(string), string etag = default(string), Scope scope = default(Scope), ConnectivityCollection connectivity = default(ConnectivityCollection)) + : base(location, id, name, type, tags) + { + ProvisioningState = provisioningState; + Etag = etag; + Scope = scope; + Connectivity = connectivity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets provisioning state of the ManagedNetwork resource. Possible + /// values are: 'Updating', 'Deleting', and 'Failed'. Possible values + /// include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "properties.etag")] + public string Etag { get; private set; } + + /// + /// Gets or sets the collection of management groups, subscriptions, + /// virtual networks, and subnets by the Managed Network. This is a + /// read-only property that is reflective of all ScopeAssignments for + /// this Managed Network + /// + [JsonProperty(PropertyName = "properties.scope")] + public Scope Scope { get; set; } + + /// + /// Gets the collection of groups and policies concerned with + /// connectivity + /// + [JsonProperty(PropertyName = "properties.connectivity")] + public ConnectivityCollection Connectivity { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkPeeringPolicy.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkPeeringPolicy.cs new file mode 100644 index 0000000000000..67325e129e92a --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkPeeringPolicy.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Managed Network Peering Policy resource + /// + public partial class ManagedNetworkPeeringPolicy : ProxyResource + { + /// + /// Initializes a new instance of the ManagedNetworkPeeringPolicy + /// class. + /// + public ManagedNetworkPeeringPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedNetworkPeeringPolicy + /// class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Gets or sets the properties of a Managed + /// Network Policy + public ManagedNetworkPeeringPolicy(string id = default(string), string name = default(string), string type = default(string), ManagedNetworkPeeringPolicyProperties properties = default(ManagedNetworkPeeringPolicyProperties)) + : base(id, name, type) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the properties of a Managed Network Policy + /// + [JsonProperty(PropertyName = "properties")] + public ManagedNetworkPeeringPolicyProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkPeeringPolicyProperties.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkPeeringPolicyProperties.cs new file mode 100644 index 0000000000000..dd617063161ab --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkPeeringPolicyProperties.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a Managed Network Peering Policy + /// + public partial class ManagedNetworkPeeringPolicyProperties : ResourceProperties + { + /// + /// Initializes a new instance of the + /// ManagedNetworkPeeringPolicyProperties class. + /// + public ManagedNetworkPeeringPolicyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedNetworkPeeringPolicyProperties class. + /// + /// Gets or sets the connectivity type of a network + /// structure policy. Possible values include: 'HubAndSpokeTopology', + /// 'MeshTopology' + /// Provisioning state of the + /// ManagedNetwork resource. Possible values are: 'Updating', + /// 'Deleting', and 'Failed'. Possible values include: 'Updating', + /// 'Deleting', 'Failed', 'Succeeded' + /// A unique read-only string that changes whenever + /// the resource is updated. + /// Gets or sets the hub virtual network ID + /// Gets or sets the spokes group IDs + /// Gets or sets the mesh group IDs + public ManagedNetworkPeeringPolicyProperties(string type, string provisioningState = default(string), string etag = default(string), ResourceId hub = default(ResourceId), IList spokes = default(IList), IList mesh = default(IList)) + : base(provisioningState, etag) + { + Type = type; + Hub = hub; + Spokes = spokes; + Mesh = mesh; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the connectivity type of a network structure policy. + /// Possible values include: 'HubAndSpokeTopology', 'MeshTopology' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the hub virtual network ID + /// + [JsonProperty(PropertyName = "hub")] + public ResourceId Hub { get; set; } + + /// + /// Gets or sets the spokes group IDs + /// + [JsonProperty(PropertyName = "spokes")] + public IList Spokes { get; set; } + + /// + /// Gets or sets the mesh group IDs + /// + [JsonProperty(PropertyName = "mesh")] + public IList Mesh { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkUpdate.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkUpdate.cs new file mode 100644 index 0000000000000..1be28e0dd9a51 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ManagedNetworkUpdate.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Update Tags of Managed Network + /// + public partial class ManagedNetworkUpdate + { + /// + /// Initializes a new instance of the ManagedNetworkUpdate class. + /// + public ManagedNetworkUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedNetworkUpdate class. + /// + /// Updates the tags property of the Managed + /// Network + public ManagedNetworkUpdate(IList tags = default(IList)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets updates the tags property of the Managed Network + /// + [JsonProperty(PropertyName = "tags")] + public IList Tags { get; set; } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/MeshPeeringPolicyProperties.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/MeshPeeringPolicyProperties.cs new file mode 100644 index 0000000000000..057f7ef6cc7a8 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/MeshPeeringPolicyProperties.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a Mesh Peering Policy + /// + public partial class MeshPeeringPolicyProperties : ManagedNetworkPeeringPolicyProperties + { + /// + /// Initializes a new instance of the MeshPeeringPolicyProperties + /// class. + /// + public MeshPeeringPolicyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MeshPeeringPolicyProperties + /// class. + /// + /// Gets or sets the connectivity type of a network + /// structure policy. Possible values include: 'HubAndSpokeTopology', + /// 'MeshTopology' + /// Provisioning state of the + /// ManagedNetwork resource. Possible values are: 'Updating', + /// 'Deleting', and 'Failed'. Possible values include: 'Updating', + /// 'Deleting', 'Failed', 'Succeeded' + /// A unique read-only string that changes whenever + /// the resource is updated. + /// Gets or sets the hub virtual network ID + /// Gets or sets the spokes group IDs + /// Gets or sets the mesh group IDs + public MeshPeeringPolicyProperties(string type, string provisioningState = default(string), string etag = default(string), ResourceId hub = default(ResourceId), IList spokes = default(IList), IList mesh = default(IList)) + : base(type, provisioningState, etag, hub, spokes, mesh) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Operation.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Operation.cs new file mode 100644 index 0000000000000..b58ad2caacde9 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Operation.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// REST API operation + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// Operation name: + /// {provider}/{resource}/{operation} + /// The object that represents the + /// operation. + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) + { + Name = name; + Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets operation name: {provider}/{resource}/{operation} + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the object that represents the operation. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/OperationDisplay.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/OperationDisplay.cs new file mode 100644 index 0000000000000..f99a59f3bb12d --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/OperationDisplay.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The object that represents the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// Service provider: + /// Microsoft.ManagedNetwork + /// Resource on which the operation is + /// performed: Profile, endpoint, etc. + /// Operation type: Read, write, delete, + /// etc. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service provider: Microsoft.ManagedNetwork + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets resource on which the operation is performed: Profile, + /// endpoint, etc. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets operation type: Read, write, delete, etc. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Page.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Page.cs new file mode 100644 index 0000000000000..d83fb5cdc841f --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ProvisioningState.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ProvisioningState.cs new file mode 100644 index 0000000000000..2b82e37a0ed65 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ProvisioningState.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + + /// + /// Defines values for ProvisioningState. + /// + public static class ProvisioningState + { + public const string Updating = "Updating"; + public const string Deleting = "Deleting"; + public const string Failed = "Failed"; + public const string Succeeded = "Succeeded"; + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ProxyResource.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ProxyResource.cs new file mode 100644 index 0000000000000..38c9b200665a0 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ProxyResource.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using System.Linq; + + /// + /// The resource model definition for a ARM proxy resource. It will have + /// everything other than required location and tags + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Resource.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Resource.cs new file mode 100644 index 0000000000000..81e58b41ca490 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Resource.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The general resource model definition + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public Resource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ResourceId.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ResourceId.cs new file mode 100644 index 0000000000000..20e92f9eda0f8 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ResourceId.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Generic pointer to a resource + /// + public partial class ResourceId + { + /// + /// Initializes a new instance of the ResourceId class. + /// + public ResourceId() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceId class. + /// + /// Resource Id + public ResourceId(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ResourceProperties.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ResourceProperties.cs new file mode 100644 index 0000000000000..3e0f31de64a72 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ResourceProperties.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Base for resource properties. + /// + public partial class ResourceProperties + { + /// + /// Initializes a new instance of the ResourceProperties class. + /// + public ResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceProperties class. + /// + /// Provisioning state of the + /// ManagedNetwork resource. Possible values are: 'Updating', + /// 'Deleting', and 'Failed'. Possible values include: 'Updating', + /// 'Deleting', 'Failed', 'Succeeded' + /// A unique read-only string that changes whenever + /// the resource is updated. + public ResourceProperties(string provisioningState = default(string), string etag = default(string)) + { + ProvisioningState = provisioningState; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets provisioning state of the ManagedNetwork resource. Possible + /// values are: 'Updating', 'Deleting', and 'Failed'. Possible values + /// include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Scope.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Scope.cs new file mode 100644 index 0000000000000..5252e17092168 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Scope.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Scope of a Managed Network + /// + public partial class Scope + { + /// + /// Initializes a new instance of the Scope class. + /// + public Scope() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Scope class. + /// + /// The collection of management groups + /// covered by the Managed Network + /// The collection of subscriptions covered + /// by the Managed Network + /// The collection of virtual nets + /// covered by the Managed Network + /// The collection of subnets covered by the + /// Managed Network + public Scope(IList managementGroups = default(IList), IList subscriptions = default(IList), IList virtualNetworks = default(IList), IList subnets = default(IList)) + { + ManagementGroups = managementGroups; + Subscriptions = subscriptions; + VirtualNetworks = virtualNetworks; + Subnets = subnets; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the collection of management groups covered by the + /// Managed Network + /// + [JsonProperty(PropertyName = "managementGroups")] + public IList ManagementGroups { get; set; } + + /// + /// Gets or sets the collection of subscriptions covered by the Managed + /// Network + /// + [JsonProperty(PropertyName = "subscriptions")] + public IList Subscriptions { get; set; } + + /// + /// Gets or sets the collection of virtual nets covered by the Managed + /// Network + /// + [JsonProperty(PropertyName = "virtualNetworks")] + public IList VirtualNetworks { get; set; } + + /// + /// Gets or sets the collection of subnets covered by the Managed + /// Network + /// + [JsonProperty(PropertyName = "subnets")] + public IList Subnets { get; set; } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ScopeAssignment.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ScopeAssignment.cs new file mode 100644 index 0000000000000..ce732aaf2ef98 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/ScopeAssignment.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Managed Network resource + /// + [Rest.Serialization.JsonTransformation] + public partial class ScopeAssignment : ProxyResource + { + /// + /// Initializes a new instance of the ScopeAssignment class. + /// + public ScopeAssignment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScopeAssignment class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Provisioning state of the + /// ManagedNetwork resource. Possible values are: 'Updating', + /// 'Deleting', and 'Failed'. Possible values include: 'Updating', + /// 'Deleting', 'Failed', 'Succeeded' + /// A unique read-only string that changes whenever + /// the resource is updated. + /// The managed network ID with + /// scope will be assigned to. + public ScopeAssignment(string id = default(string), string name = default(string), string type = default(string), string provisioningState = default(string), string etag = default(string), string assignedManagedNetwork = default(string)) + : base(id, name, type) + { + ProvisioningState = provisioningState; + Etag = etag; + AssignedManagedNetwork = assignedManagedNetwork; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets provisioning state of the ManagedNetwork resource. Possible + /// values are: 'Updating', 'Deleting', and 'Failed'. Possible values + /// include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "properties.etag")] + public string Etag { get; private set; } + + /// + /// Gets or sets the managed network ID with scope will be assigned to. + /// + [JsonProperty(PropertyName = "properties.assignedManagedNetwork")] + public string AssignedManagedNetwork { get; set; } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/TrackedResource.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/TrackedResource.cs new file mode 100644 index 0000000000000..d90eca9f39806 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/TrackedResource.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource model definition for a ARM tracked top level resource + /// + public partial class TrackedResource : Resource + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IList tags = default(IList)) + : base(id, name, type) + { + Tags = tags; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IList Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Type.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Type.cs new file mode 100644 index 0000000000000..2e52f5b2ca9d9 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Models/Type.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork.Models +{ + + /// + /// Defines values for Type. + /// + public static class Type + { + public const string HubAndSpokeTopology = "HubAndSpokeTopology"; + public const string MeshTopology = "MeshTopology"; + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Operations.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Operations.cs new file mode 100644 index 0000000000000..bf6b8284e0786 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/Operations.cs @@ -0,0 +1,390 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(ManagedNetworkManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ManagedNetworkManagementClient + /// + public ManagedNetworkManagementClient Client { get; private set; } + + /// + /// Lists all of the available MNC operations. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.ManagedNetwork/operations").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the available MNC operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/OperationsExtensions.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/OperationsExtensions.cs new file mode 100644 index 0000000000000..41bf881716b51 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/OperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists all of the available MNC operations. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available MNC operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the available MNC operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available MNC operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ScopeAssignmentsOperations.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ScopeAssignmentsOperations.cs new file mode 100644 index 0000000000000..41293449fa8c3 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ScopeAssignmentsOperations.cs @@ -0,0 +1,980 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ScopeAssignmentsOperations operations. + /// + internal partial class ScopeAssignmentsOperations : IServiceOperations, IScopeAssignmentsOperations + { + /// + /// Initializes a new instance of the ScopeAssignmentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ScopeAssignmentsOperations(ManagedNetworkManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ManagedNetworkManagementClient + /// + public ManagedNetworkManagementClient Client { get; private set; } + + /// + /// Get the specified scope assignment. + /// + /// + /// The base resource of the scope assignment. + /// + /// + /// The name of the scope assignment to get. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string scope, string scopeAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (scopeAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopeAssignmentName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("scopeAssignmentName", scopeAssignmentName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{scopeAssignmentName}", System.Uri.EscapeDataString(scopeAssignmentName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a scope assignment. + /// + /// + /// Parameters supplied to the specify which Managed Network this scope is + /// being assigned + /// + /// + /// 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. + /// + /// + /// The name of the scope assignment to create. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(ScopeAssignment parameters, string scope, string scopeAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (scopeAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopeAssignmentName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("scope", scope); + tracingParameters.Add("scopeAssignmentName", scopeAssignmentName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{scopeAssignmentName}", System.Uri.EscapeDataString(scopeAssignmentName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a scope assignment. + /// + /// + /// The scope of the scope assignment to delete. + /// + /// + /// The name of the scope assignment to delete. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string scope, string scopeAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (scopeAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopeAssignmentName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("scopeAssignmentName", scopeAssignmentName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{scopeAssignmentName}", System.Uri.EscapeDataString(scopeAssignmentName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the specified scope assignment. + /// + /// + /// The base resource of the scope assignment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the specified scope assignment. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ScopeAssignmentsOperationsExtensions.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ScopeAssignmentsOperationsExtensions.cs new file mode 100644 index 0000000000000..b6715a73205d0 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/src/generated/ScopeAssignmentsOperationsExtensions.cs @@ -0,0 +1,230 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagedNetwork +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ScopeAssignmentsOperations. + /// + public static partial class ScopeAssignmentsOperationsExtensions + { + /// + /// Get the specified scope assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The base resource of the scope assignment. + /// + /// + /// The name of the scope assignment to get. + /// + public static ScopeAssignment Get(this IScopeAssignmentsOperations operations, string scope, string scopeAssignmentName) + { + return operations.GetAsync(scope, scopeAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Get the specified scope assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The base resource of the scope assignment. + /// + /// + /// The name of the scope assignment to get. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IScopeAssignmentsOperations operations, string scope, string scopeAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, scopeAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a scope assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the specify which Managed Network this scope is + /// being assigned + /// + /// + /// 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. + /// + /// + /// The name of the scope assignment to create. + /// + public static ScopeAssignment CreateOrUpdate(this IScopeAssignmentsOperations operations, ScopeAssignment parameters, string scope, string scopeAssignmentName) + { + return operations.CreateOrUpdateAsync(parameters, scope, scopeAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Creates a scope assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the specify which Managed Network this scope is + /// being assigned + /// + /// + /// 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. + /// + /// + /// The name of the scope assignment to create. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IScopeAssignmentsOperations operations, ScopeAssignment parameters, string scope, string scopeAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(parameters, scope, scopeAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a scope assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the scope assignment to delete. + /// + /// + /// The name of the scope assignment to delete. + /// + public static void Delete(this IScopeAssignmentsOperations operations, string scope, string scopeAssignmentName) + { + operations.DeleteAsync(scope, scopeAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a scope assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the scope assignment to delete. + /// + /// + /// The name of the scope assignment to delete. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IScopeAssignmentsOperations operations, string scope, string scopeAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(scope, scopeAssignmentName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get the specified scope assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The base resource of the scope assignment. + /// + public static IPage List(this IScopeAssignmentsOperations operations, string scope) + { + return operations.ListAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Get the specified scope assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The base resource of the scope assignment. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IScopeAssignmentsOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the specified scope assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IScopeAssignmentsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get the specified scope assignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IScopeAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Helpers/Comparator.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Helpers/Comparator.cs new file mode 100644 index 0000000000000..8f08f99f25413 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Helpers/Comparator.cs @@ -0,0 +1,197 @@ +namespace ManagedNetwork.Tests.Helpers +{ + using Microsoft.Azure.Management.ManagedNetwork.Models; + using Xunit; + using System.Collections.Generic; + + public static class Comparator + { + public static void CompareManagedNetwork(ManagedNetworkModel mn1, ManagedNetworkModel mn2) + { + Assert.Equal(mn1.Location, mn2.Location); + + CompareScope(mn1.Scope, mn2.Scope); + + if (mn1.Connectivity == null) + { + if(mn2.Connectivity != null) + { + Assert.Equal(0, mn2.Connectivity.Groups.Count); + Assert.Equal(0, mn2.Connectivity.Peerings.Count); + } + } + else + { + CompareConnectivityCollection(mn1.Connectivity, mn2.Connectivity); + } + + } + + public static void CompareScope(Scope s1, Scope s2) + { + if (s1.ManagementGroups != null) + { + Assert.Equal(s1.ManagementGroups.Count, s2.ManagementGroups.Count); + for (int i = 0; i < s1.ManagementGroups.Count; i++) + { + Assert.Equal(s1.ManagementGroups[i].Id, s2.ManagementGroups[i].Id); + } + } + + if (s1.Subscriptions != null) + { + Assert.Equal(s1.Subscriptions.Count, s2.Subscriptions.Count); + for (int i = 0; i < s1.Subscriptions.Count; i++) + { + Assert.Equal(s1.Subscriptions[i].Id, s2.Subscriptions[i].Id); + } + } + + if (s1.VirtualNetworks != null) + { + Assert.Equal(s1.VirtualNetworks.Count, s2.VirtualNetworks.Count); + for (int i = 0; i < s1.VirtualNetworks.Count; i++) + { + Assert.Equal(s1.VirtualNetworks[i].Id, s2.VirtualNetworks[i].Id); + } + } + + if (s1.VirtualNetworks != null) + { + Assert.Equal(s1.Subnets.Count, s2.Subnets.Count); + for (int i = 0; i < s1.Subnets.Count; i++) + { + Assert.Equal(s1.Subnets[i].Id, s2.Subnets[i].Id); + } + } + } + public static void CompareManagedNetworkGroup(ManagedNetworkGroup g1, ManagedNetworkGroup g2) + { + if (g1.ManagementGroups == null) + { + Assert.Equal(0, g2.ManagementGroups.Count); + } + else + { + Assert.Equal(g1.ManagementGroups.Count, g2.ManagementGroups.Count); + for (int i = 0; i < g1.ManagementGroups.Count; i++) + { + Assert.Equal(g1.ManagementGroups[i].Id, g2.ManagementGroups[i].Id); + } + } + + if (g1.Subscriptions == null) + { + Assert.Equal(0, g2.Subscriptions.Count); + } + else + { + Assert.Equal(g1.Subscriptions.Count, g2.Subscriptions.Count); + for (int i = 0; i < g1.Subscriptions.Count; i++) + { + Assert.Equal(g1.Subscriptions[i].Id, g2.Subscriptions[i].Id); + } + } + + if (g1.VirtualNetworks == null) + { + Assert.Equal(0, g2.VirtualNetworks.Count); + } + else + { + Assert.Equal(g1.VirtualNetworks.Count, g2.VirtualNetworks.Count); + for (int i = 0; i < g1.VirtualNetworks.Count; i++) + { + Assert.Equal(g1.VirtualNetworks[i].Id, g2.VirtualNetworks[i].Id); + } + } + + if (g1.Subnets == null) + { + if (g1.Subnets != null) + { + Assert.Equal(0, g2.Subnets.Count); + } + + } + else + { + Assert.Equal(g1.Subnets.Count, g2.Subnets.Count); + for (int i = 0; i < g1.Subnets.Count; i++) + { + Assert.Equal(g1.Subnets[i].Id, g2.Subnets[i].Id); + } + } + } + + public static void CompareConnectivityCollection(ConnectivityCollection c1, ConnectivityCollection c2) + { + Assert.Equal(c1.Groups.Count, c2.Groups.Count); + for (int i = 0; i < c1.Groups.Count; i++) + { + CompareManagedNetworkGroup(c1.Groups[i], c2.Groups[i]); + } + + Assert.Equal(c1.Peerings.Count, c2.Peerings.Count); + for (int i = 0; i < c1.Peerings.Count; i++) + { + ComparePeeringPolicy(c1.Peerings[i], c1.Peerings[i]); + } + } + + public static void CompareTags(IList tags1, IList tags2) + { + Assert.Equal(tags1.Count, tags2.Count); + for (int i = 0; i < tags1.Count; i++) + { + Assert.Equal(tags1[i], tags2[i]); + } + } + + public static void ComparePeeringPolicy(ManagedNetworkPeeringPolicy p1, ManagedNetworkPeeringPolicy p2) + { + if (p1.Properties.Hub == null) + { + Assert.Null(p2.Properties.Hub); + } + else + { + Assert.Equal(p1.Properties.Hub.Id, p2.Properties.Hub.Id); + } + + if (p1.Properties.Spokes == null) + { + if (p2.Properties.Spokes != null) + { + Assert.Equal(0, p2.Properties.Spokes.Count); + } + + } + else + { + Assert.Equal(p1.Properties.Spokes.Count, p2.Properties.Spokes.Count); + for (int i = 0; i < p1.Properties.Spokes.Count; i++) + { + Assert.Equal(p1.Properties.Spokes[i].Id, p2.Properties.Spokes[i].Id); + } + } + + if (p1.Properties.Mesh == null) + { + if (p2.Properties.Mesh != null) + { + Assert.Equal(0, p2.Properties.Mesh.Count); + } + } + else + { + Assert.Equal(p1.Properties.Mesh.Count, p2.Properties.Mesh.Count); + for (int i = 0; i < p1.Properties.Mesh.Count; i++) + { + Assert.Equal(p1.Properties.Mesh[i].Id, p2.Properties.Mesh[i].Id); + } + } + + } + } +} diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Microsoft.Azure.Management.ManagedNetwork.Tests.csproj b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Microsoft.Azure.Management.ManagedNetwork.Tests.csproj new file mode 100644 index 0000000000000..745a886816980 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Microsoft.Azure.Management.ManagedNetwork.Tests.csproj @@ -0,0 +1,25 @@ + + + + + ManagedNetwork.Tests + ManagedNetwork.Tests class library + ManagedNetwork.Tests + 1.0.0-preview + true + + + + netcoreapp2.0 + + + + + + + + + PreserveNewest + + + \ No newline at end of file diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Properties/AssemblyInfo.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000..a14da2a734680 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("ManagedNetwork.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("ManagedNetwork.Tests")] +[assembly: AssemblyCopyright("Copyright © Microsoft Corporation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: AssemblyVersion("0.1.0")] +[assembly: AssemblyFileVersion("0.1.0")] diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.ManagedNetworkGroupTests/ManagedNetworkGroupTest.json b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.ManagedNetworkGroupTests/ManagedNetworkGroupTest.json new file mode 100644 index 0000000000000..a82c71a9f0403 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.ManagedNetworkGroupTests/ManagedNetworkGroupTest.json @@ -0,0 +1,470 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourcegroups/MNCRP_RSG9542?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlZ3JvdXBzL01OQ1JQX1JTRzk1NDI/YXBpLXZlcnNpb249MjAxNS0xMS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "74259f4c-3f31-4755-9dcb-081fd82fe192" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-failure-cause": [ + "gateway" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14999" + ], + "x-ms-request-id": [ + "bf74c5d1-d7c4-42d7-a49b-49075fd3d03d" + ], + "x-ms-correlation-request-id": [ + "bf74c5d1-d7c4-42d7-a49b-49075fd3d03d" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232135Z:bf74c5d1-d7c4-42d7-a49b-49075fd3d03d" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:21:34 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "105" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceGroupNotFound\",\r\n \"message\": \"Resource group 'MNCRP_RSG9542' could not be found.\"\r\n }\r\n}", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourcegroups/MNCRP_RSG9542?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlZ3JvdXBzL01OQ1JQX1JTRzk1NDI/YXBpLXZlcnNpb249MjAxNS0xMS0wMQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"West US\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "064328c1-3743-47df-8928-7ce96c343f4b" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "29" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "b4694fee-8431-4aff-bf9f-e9fc220278c3" + ], + "x-ms-correlation-request-id": [ + "b4694fee-8431-4aff-bf9f-e9fc220278c3" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232138Z:b4694fee-8431-4aff-bf9f-e9fc220278c3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:21:38 GMT" + ], + "Content-Length": [ + "179" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542\",\r\n \"name\": \"MNCRP_RSG9542\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork229?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzk1NDIvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazIyOT9hcGktdmVyc2lvbj0yMDE5LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ]\r\n }\r\n },\r\n \"location\": \"West US\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "5150bbb0-7698-4aa1-99b0-48692d503be5" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "618" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "cdb2b276-2919-4b17-93f8-528ce0efcd0c" + ], + "x-ms-correlation-request-id": [ + "cdb2b276-2919-4b17-93f8-528ce0efcd0c" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232141Z:cdb2b276-2919-4b17-93f8-528ce0efcd0c" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:21:41 GMT" + ], + "Content-Length": [ + "873" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork229\",\r\n \"name\": \"myManagedNetwork229\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"West US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": []\r\n }\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork229/managedNetworkGroups/myGroup4390?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzk1NDIvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazIyOS9tYW5hZ2VkTmV0d29ya0dyb3Vwcy9teUdyb3VwNDM5MD9hcGktdmVyc2lvbj0yMDE5LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ]\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "629f942c-4c5a-4571-8854-17f6dd109731" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "386" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "e95f3940-3dc9-4dfa-95e3-4a5d0b697e06" + ], + "x-ms-correlation-request-id": [ + "e95f3940-3dc9-4dfa-95e3-4a5d0b697e06" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232143Z:e95f3940-3dc9-4dfa-95e3-4a5d0b697e06" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:21:42 GMT" + ], + "Content-Length": [ + "709" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork229/managedNetworkGroups/myGroup4390\",\r\n \"name\": \"myGroup4390\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork229/managedNetworkGroups/myGroup4390?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzk1NDIvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazIyOS9tYW5hZ2VkTmV0d29ya0dyb3Vwcy9teUdyb3VwNDM5MD9hcGktdmVyc2lvbj0yMDE5LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "e6afad93-4c7a-41ee-b158-0af8523f6662" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14999" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "df1c45e0-ca5d-4a59-ac9e-60631e68cb6b" + ], + "x-ms-correlation-request-id": [ + "df1c45e0-ca5d-4a59-ac9e-60631e68cb6b" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232143Z:df1c45e0-ca5d-4a59-ac9e-60631e68cb6b" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:21:43 GMT" + ], + "Content-Length": [ + "745" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork229/managedNetworkGroups/myGroup4390\",\r\n \"name\": \"myGroup4390\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"f2f77648-96a1-4bb4-9dc3-8f3a25d4f15e\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork229?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzk1NDIvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazIyOT9hcGktdmVyc2lvbj0yMDE5LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "bad7840e-8845-4592-8a9b-dee356f08060" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14998" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "98873580-8b33-4154-9fcf-b7e20d23997b" + ], + "x-ms-correlation-request-id": [ + "98873580-8b33-4154-9fcf-b7e20d23997b" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232144Z:98873580-8b33-4154-9fcf-b7e20d23997b" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:21:44 GMT" + ], + "Content-Length": [ + "1654" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork229\",\r\n \"name\": \"myManagedNetwork229\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"West US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"c38c422d-50ad-43be-ad32-10e893622996\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork229/managedNetworkGroups/myGroup4390\",\r\n \"name\": \"myGroup4390\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"f2f77648-96a1-4bb4-9dc3-8f3a25d4f15e\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork229/managedNetworkGroups?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzk1NDIvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazIyOS9tYW5hZ2VkTmV0d29ya0dyb3Vwcz9hcGktdmVyc2lvbj0yMDE5LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "d4d25ff2-68a4-4782-89e0-3de8f94a60ed" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14997" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "8e15230a-19a6-46ed-a8a1-26873ab165ca" + ], + "x-ms-correlation-request-id": [ + "8e15230a-19a6-46ed-a8a1-26873ab165ca" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232145Z:8e15230a-19a6-46ed-a8a1-26873ab165ca" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:21:45 GMT" + ], + "Content-Length": [ + "771" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"nextLink\": \"\",\r\n \"value\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork229/managedNetworkGroups/myGroup4390\",\r\n \"name\": \"myGroup4390\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"f2f77648-96a1-4bb4-9dc3-8f3a25d4f15e\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n }\r\n ]\r\n}", + "StatusCode": 200 + } + ], + "Names": { + "ManagedNetworkGroupTest": [ + "MNCRP_RSG9542", + "myManagedNetwork229", + "myGroup4390" + ] + }, + "Variables": { + "SubscriptionId": "0c8037cf-745c-47eb-94f0-565cb9250814" + } +} \ No newline at end of file diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.ManagedNetworkTests/ManagedNetworkTest.json b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.ManagedNetworkTests/ManagedNetworkTest.json new file mode 100644 index 0000000000000..97af13f43e0ec --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.ManagedNetworkTests/ManagedNetworkTest.json @@ -0,0 +1,460 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourcegroups/MNCRP_RSG3268?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlZ3JvdXBzL01OQ1JQX1JTRzMyNjg/YXBpLXZlcnNpb249MjAxNS0xMS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "17e068c7-186a-468b-8c29-aae8eb177d39" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-failure-cause": [ + "gateway" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14992" + ], + "x-ms-request-id": [ + "7e3372bf-5e9c-44a9-bcd3-a128f19a606e" + ], + "x-ms-correlation-request-id": [ + "7e3372bf-5e9c-44a9-bcd3-a128f19a606e" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232207Z:7e3372bf-5e9c-44a9-bcd3-a128f19a606e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:06 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "105" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceGroupNotFound\",\r\n \"message\": \"Resource group 'MNCRP_RSG3268' could not be found.\"\r\n }\r\n}", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourcegroups/MNCRP_RSG3268?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlZ3JvdXBzL01OQ1JQX1JTRzMyNjg/YXBpLXZlcnNpb249MjAxNS0xMS0wMQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"Central US\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "a1de388f-2032-4fab-b6a3-cdb0be539bb7" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "32" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1193" + ], + "x-ms-request-id": [ + "e59cfab6-f7a6-4691-9b9c-a15d721adc29" + ], + "x-ms-correlation-request-id": [ + "e59cfab6-f7a6-4691-9b9c-a15d721adc29" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232210Z:e59cfab6-f7a6-4691-9b9c-a15d721adc29" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:10 GMT" + ], + "Content-Length": [ + "182" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG3268\",\r\n \"name\": \"MNCRP_RSG3268\",\r\n \"location\": \"centralus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG3268/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork5793?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzMyNjgvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazU3OTM/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"scope\": {\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n }\r\n ],\r\n \"subnets\": []\r\n }\r\n },\r\n \"location\": \"Central US\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "41bb87cc-5d7a-452a-938c-cbe8ec8e3c43" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "364" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "4eb98158-5d5f-4849-a846-2cfeb29a80b9" + ], + "x-ms-correlation-request-id": [ + "4eb98158-5d5f-4849-a846-2cfeb29a80b9" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232212Z:4eb98158-5d5f-4849-a846-2cfeb29a80b9" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:12 GMT" + ], + "Content-Length": [ + "606" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG3268/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork5793\",\r\n \"name\": \"myManagedNetwork5793\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"Central US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": []\r\n }\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG3268/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork5793?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzMyNjgvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazU3OTM/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "d73779cb-2391-4aa7-bd84-3936137b5647" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14998" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "2883bfc8-c42b-4547-ab5a-32f33d227f55" + ], + "x-ms-correlation-request-id": [ + "2883bfc8-c42b-4547-ab5a-32f33d227f55" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232213Z:2883bfc8-c42b-4547-ab5a-32f33d227f55" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:12 GMT" + ], + "Content-Length": [ + "642" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG3268/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork5793\",\r\n \"name\": \"myManagedNetwork5793\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"Central US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"46020ec5-a35e-4cd2-8852-60a0fef07ea9\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": []\r\n }\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/providers/Microsoft.ManagedNetwork/managedNetworks?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Byb3ZpZGVycy9NaWNyb3NvZnQuTWFuYWdlZE5ldHdvcmsvbWFuYWdlZE5ldHdvcmtzP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "f38fc215-3063-4f6f-b907-7185409f444b" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14997" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "6bd19d0d-13fe-4fdb-9cfe-6205dbaf156a" + ], + "x-ms-correlation-request-id": [ + "6bd19d0d-13fe-4fdb-9cfe-6205dbaf156a" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232214Z:6bd19d0d-13fe-4fdb-9cfe-6205dbaf156a" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:13 GMT" + ], + "Content-Length": [ + "19759" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"nextLink\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/providers/Microsoft.ManagedNetwork/managedNetworks?firstIndex=10&pageSize=10\",\r\n \"value\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/Portal_ManagedNetwork9\",\r\n \"name\": \"Portal_ManagedNetwork9\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"Central US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"6f69ee96-7bc7-494d-a95d-519443fd456e\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke3\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke4\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke5\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Hub\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/Portal_ManagedNetwork9/managedNetworkPeeringPolicies/SDK_MeshPolicy3\",\r\n \"name\": \"SDK_MeshPolicy3\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkPeeringPolicies\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"fdc94088-1125-4540-8289-3c5a68990fa6\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"type\": 1,\r\n \"hub\": {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Hub\"\r\n },\r\n \"spokes\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/Portal_ManagedNetwork9/managedNetworkGroups/Portal_SpokeGroup1\"\r\n }\r\n ],\r\n \"mesh\": []\r\n }\r\n }\r\n ],\r\n \"groups\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/Portal_ManagedNetwork9/managedNetworkGroups/Portal_SpokeGroup1\",\r\n \"name\": \"Portal_SpokeGroup1\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"94b3aa23-7e3a-49a4-afb3-d9553fd6650f\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke3\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke4\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke5\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/SDK_ManagedNetwork_Mesh1\",\r\n \"name\": \"SDK_ManagedNetwork_Mesh1\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"Central US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"ef6b1479-25cd-4328-89e3-d39b0d4a803b\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh3\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh4\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh5\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/SDK_ManagedNetwork_Mesh1/managedNetworkPeeringPolicies/SDK_MeshPolicy\",\r\n \"name\": \"SDK_MeshPolicy\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkPeeringPolicies\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"e3c73925-a736-4cea-b123-0c6cab0767f9\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"type\": 2,\r\n \"hub\": null,\r\n \"spokes\": [],\r\n \"mesh\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/SDK_ManagedNetwork_Mesh1/managedNetworkGroups/SDK_MeshGroup\"\r\n }\r\n ]\r\n }\r\n }\r\n ],\r\n \"groups\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/SDK_ManagedNetwork_Mesh1/managedNetworkGroups/SDK_MeshGroup\",\r\n \"name\": \"SDK_MeshGroup\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"a6cdfe3f-f6e8-4b26-9d15-e9387110e3d8\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh3\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh4\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh5\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG7128/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork2555\",\r\n \"name\": \"myManagedNetwork2555\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"West US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"526e0504-3a0b-46be-a798-6686c4c5bf60\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG7128/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork2555/managedNetworkGroups/myGroup1432\",\r\n \"name\": \"myGroup1432\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"cf7c8517-f446-4b87-a946-be8eadd27257\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG7642/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork1838\",\r\n \"name\": \"myManagedNetwork1838\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"West US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"fcb68e9d-a38f-4020-8eec-dea80e380bb4\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG7642/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork1838/managedNetworkGroups/myGroup1965\",\r\n \"name\": \"myGroup1965\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"cb53b4a9-d6c0-44b1-8241-5c033ba6abf7\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG7221/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork55\",\r\n \"name\": \"myManagedNetwork55\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"West US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"865546a9-99c2-4cab-af4f-e78ba707aa5f\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG7221/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork55/managedNetworkGroups/myGroup9887\",\r\n \"name\": \"myGroup9887\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"4e4b8dc3-e3ed-47ab-b9bb-cb6dbeca7646\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG3947/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork7668\",\r\n \"name\": \"myManagedNetwork7668\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"West US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"a2fbe34d-2d12-4dfe-95aa-ac5cfc48ff38\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG3947/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork7668/managedNetworkGroups/myGroup7015\",\r\n \"name\": \"myGroup7015\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"670c983f-d521-4509-a1ef-83f27fd37f2c\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG7366/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8096\",\r\n \"name\": \"myManagedNetwork8096\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"West US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"584938c6-7658-48e1-825e-41fd2f75bc50\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG7366/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8096/managedNetworkGroups/myGroup4646\",\r\n \"name\": \"myGroup4646\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"bfa8260c-97d5-49de-b037-06e4a9345c4e\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9990/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8953\",\r\n \"name\": \"myManagedNetwork8953\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"West US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"5accef67-1e8d-4f62-8a05-0618816ab1c8\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9990/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8953/managedNetworkGroups/myGroup6189\",\r\n \"name\": \"myGroup6189\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"4da899e6-dfdd-46f3-ba6f-9c51f94ccf30\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork229\",\r\n \"name\": \"myManagedNetwork229\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"West US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"c38c422d-50ad-43be-ad32-10e893622996\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG9542/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork229/managedNetworkGroups/myGroup4390\",\r\n \"name\": \"myGroup4390\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"f2f77648-96a1-4bb4-9dc3-8f3a25d4f15e\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189\",\r\n \"name\": \"myManagedNetwork8189\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"West US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"f3e5c15d-3e13-49fe-b016-e1623b3810b8\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkGroups/myGroup9955\",\r\n \"name\": \"myGroup9955\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"3ab86d8a-d5e0-4383-8593-fb07c3d5499f\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n ]\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG3268/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork5793?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzMyNjgvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazU3OTM/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "a14fa373-7575-43a9-b802-058f54b4756a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14998" + ], + "x-ms-request-id": [ + "5b9f0bd0-f22d-42cc-ab6e-624a69d95935" + ], + "x-ms-correlation-request-id": [ + "5b9f0bd0-f22d-42cc-ab6e-624a69d95935" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232215Z:5b9f0bd0-f22d-42cc-ab6e-624a69d95935" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:14 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG3268/providers/Microsoft.ManagedNetwork/managedNetworks?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzMyNjgvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3M/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "9bc7983d-ba01-4925-ac72-223b108be2f5" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14996" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "023f7723-feda-4c91-adfe-648d422e6564" + ], + "x-ms-correlation-request-id": [ + "023f7723-feda-4c91-adfe-648d422e6564" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232216Z:023f7723-feda-4c91-adfe-648d422e6564" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:15 GMT" + ], + "Content-Length": [ + "26" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"nextLink\": \"\",\r\n \"value\": []\r\n}", + "StatusCode": 200 + } + ], + "Names": { + "ManagedNetworkTest": [ + "MNCRP_RSG3268", + "myManagedNetwork5793" + ] + }, + "Variables": { + "SubscriptionId": "0c8037cf-745c-47eb-94f0-565cb9250814" + } +} \ No newline at end of file diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.PeeringPolicyTests/ManagedNetworkGroupTest.json b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.PeeringPolicyTests/ManagedNetworkGroupTest.json new file mode 100644 index 0000000000000..825f68e6f3e65 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.PeeringPolicyTests/ManagedNetworkGroupTest.json @@ -0,0 +1,600 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourcegroups/MNCRP_RSG2333?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlZ3JvdXBzL01OQ1JQX1JTRzIzMzM/YXBpLXZlcnNpb249MjAxNS0xMS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "d97321c1-ca12-4fa7-a75d-df92a107c3f1" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-failure-cause": [ + "gateway" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14996" + ], + "x-ms-request-id": [ + "c377bd98-7989-4e6a-a3d8-de2dc3213b94" + ], + "x-ms-correlation-request-id": [ + "c377bd98-7989-4e6a-a3d8-de2dc3213b94" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232150Z:c377bd98-7989-4e6a-a3d8-de2dc3213b94" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:21:50 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "105" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceGroupNotFound\",\r\n \"message\": \"Resource group 'MNCRP_RSG2333' could not be found.\"\r\n }\r\n}", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourcegroups/MNCRP_RSG2333?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlZ3JvdXBzL01OQ1JQX1JTRzIzMzM/YXBpLXZlcnNpb249MjAxNS0xMS0wMQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"West US\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1ebbf842-ad67-403f-bd45-24938d403112" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "29" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1197" + ], + "x-ms-request-id": [ + "7a34a3b0-d502-46c3-a9d0-873cd6be0f22" + ], + "x-ms-correlation-request-id": [ + "7a34a3b0-d502-46c3-a9d0-873cd6be0f22" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232153Z:7a34a3b0-d502-46c3-a9d0-873cd6be0f22" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:21:52 GMT" + ], + "Content-Length": [ + "179" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333\",\r\n \"name\": \"MNCRP_RSG2333\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzIzMzMvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazgxODk/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ]\r\n }\r\n },\r\n \"location\": \"West US\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "7759acf2-08b3-434d-bb2c-897a4ed4d86e" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "618" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "2ac3d64e-efac-4e2d-8cfb-30e4922a315a" + ], + "x-ms-correlation-request-id": [ + "2ac3d64e-efac-4e2d-8cfb-30e4922a315a" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232155Z:2ac3d64e-efac-4e2d-8cfb-30e4922a315a" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:21:55 GMT" + ], + "Content-Length": [ + "875" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189\",\r\n \"name\": \"myManagedNetwork8189\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"West US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": []\r\n }\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkGroups/myGroup9955?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzIzMzMvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazgxODkvbWFuYWdlZE5ldHdvcmtHcm91cHMvbXlHcm91cDk5NTU/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ]\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "ca812898-6838-4934-8540-8ae34853e155" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "386" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1195" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "b9be0490-ea76-43a5-84fc-a574d8141406" + ], + "x-ms-correlation-request-id": [ + "b9be0490-ea76-43a5-84fc-a574d8141406" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232157Z:b9be0490-ea76-43a5-84fc-a574d8141406" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:21:57 GMT" + ], + "Content-Length": [ + "710" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkGroups/myGroup9955\",\r\n \"name\": \"myGroup9955\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkPeeringPolicies/hubAndSpoke6454?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzIzMzMvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazgxODkvbWFuYWdlZE5ldHdvcmtQZWVyaW5nUG9saWNpZXMvaHViQW5kU3Bva2U2NDU0P2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"type\": \"HubAndSpokeTopology\",\r\n \"hub\": {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n \"spokes\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkGroups/myGroup9955\"\r\n }\r\n ]\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "aca22bc1-9003-4a89-9cde-210510b8383a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "470" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1194" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "b4102b31-f17d-4a65-9a99-e2f4a6249457" + ], + "x-ms-correlation-request-id": [ + "b4102b31-f17d-4a65-9a99-e2f4a6249457" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232159Z:b4102b31-f17d-4a65-9a99-e2f4a6249457" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:21:58 GMT" + ], + "Content-Length": [ + "754" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkPeeringPolicies/hubAndSpoke6454\",\r\n \"name\": \"hubAndSpoke6454\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkPeeringPolicies\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"type\": 1,\r\n \"hub\": {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n \"spokes\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkGroups/myGroup9955\"\r\n }\r\n ],\r\n \"mesh\": []\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkPeeringPolicies/hubAndSpoke6454?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzIzMzMvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazgxODkvbWFuYWdlZE5ldHdvcmtQZWVyaW5nUG9saWNpZXMvaHViQW5kU3Bva2U2NDU0P2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "ba61f507-2d36-46a4-ac78-a0c2f8813dc4" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14995" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "c792f1ff-f96a-409b-8434-56e6cc8c37ae" + ], + "x-ms-correlation-request-id": [ + "c792f1ff-f96a-409b-8434-56e6cc8c37ae" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232200Z:c792f1ff-f96a-409b-8434-56e6cc8c37ae" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:21:59 GMT" + ], + "Content-Length": [ + "790" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkPeeringPolicies/hubAndSpoke6454\",\r\n \"name\": \"hubAndSpoke6454\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkPeeringPolicies\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"ae600c08-2f13-4995-8a8a-d5ea0fce857d\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"type\": 1,\r\n \"hub\": {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n \"spokes\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkGroups/myGroup9955\"\r\n }\r\n ],\r\n \"mesh\": []\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzIzMzMvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazgxODk/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "7ec46469-9409-4b87-8baa-db9d3684c3a6" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14994" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "58c6ddbd-3603-4a8c-b4a2-3c90a60ebb0d" + ], + "x-ms-correlation-request-id": [ + "58c6ddbd-3603-4a8c-b4a2-3c90a60ebb0d" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232201Z:58c6ddbd-3603-4a8c-b4a2-3c90a60ebb0d" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:00 GMT" + ], + "Content-Length": [ + "2447" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189\",\r\n \"name\": \"myManagedNetwork8189\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"West US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"f3e5c15d-3e13-49fe-b016-e1623b3810b8\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkPeeringPolicies/hubAndSpoke6454\",\r\n \"name\": \"hubAndSpoke6454\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkPeeringPolicies\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"ae600c08-2f13-4995-8a8a-d5ea0fce857d\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"type\": 1,\r\n \"hub\": {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n \"spokes\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkGroups/myGroup9955\"\r\n }\r\n ],\r\n \"mesh\": []\r\n }\r\n }\r\n ],\r\n \"groups\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkGroups/myGroup9955\",\r\n \"name\": \"myGroup9955\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"3ab86d8a-d5e0-4383-8593-fb07c3d5499f\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkPeeringPolicies?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzIzMzMvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazgxODkvbWFuYWdlZE5ldHdvcmtQZWVyaW5nUG9saWNpZXM/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "4fa3b56f-8624-410f-82d0-d7afadc4824c" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14993" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "a2b74115-8a95-4d32-a04e-8515c5e3ec93" + ], + "x-ms-correlation-request-id": [ + "a2b74115-8a95-4d32-a04e-8515c5e3ec93" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232202Z:a2b74115-8a95-4d32-a04e-8515c5e3ec93" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:01 GMT" + ], + "Content-Length": [ + "816" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"nextLink\": \"\",\r\n \"value\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkPeeringPolicies/hubAndSpoke6454\",\r\n \"name\": \"hubAndSpoke6454\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkPeeringPolicies\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"ae600c08-2f13-4995-8a8a-d5ea0fce857d\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"type\": 1,\r\n \"hub\": {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet\"\r\n },\r\n \"spokes\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkGroups/myGroup9955\"\r\n }\r\n ],\r\n \"mesh\": []\r\n }\r\n }\r\n ]\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNCRP_RSG2333/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork8189/managedNetworkPeeringPolicies/hubAndSpoke6454?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQ1JQX1JTRzIzMzMvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yazgxODkvbWFuYWdlZE5ldHdvcmtQZWVyaW5nUG9saWNpZXMvaHViQW5kU3Bva2U2NDU0P2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "b8946d5e-139e-4519-9684-25d8e149a781" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-request-id": [ + "89471c4b-de32-4b5b-b538-916ab1156728" + ], + "x-ms-correlation-request-id": [ + "89471c4b-de32-4b5b-b538-916ab1156728" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232203Z:89471c4b-de32-4b5b-b538-916ab1156728" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:02 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + } + ], + "Names": { + "ManagedNetworkGroupTest": [ + "MNCRP_RSG2333", + "myManagedNetwork8189", + "myGroup9955", + "hubAndSpoke6454" + ] + }, + "Variables": { + "SubscriptionId": "0c8037cf-745c-47eb-94f0-565cb9250814" + } +} \ No newline at end of file diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.Tests/Clear.json b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.Tests/Clear.json new file mode 100644 index 0000000000000..37fde0f6e4637 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.Tests/Clear.json @@ -0,0 +1,197 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourcegroups/MNC-Portal?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlZ3JvdXBzL01OQy1Qb3J0YWw/YXBpLXZlcnNpb249MjAxNS0xMS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "e69e9542-fd88-480d-b696-53e88e5fa725" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14990" + ], + "x-ms-request-id": [ + "6a4ea07c-825d-4345-b527-fecb5ee668fe" + ], + "x-ms-correlation-request-id": [ + "6a4ea07c-825d-4345-b527-fecb5ee668fe" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232228Z:6a4ea07c-825d-4345-b527-fecb5ee668fe" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:27 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "176" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal\",\r\n \"name\": \"MNC-Portal\",\r\n \"location\": \"centralus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQy1Qb3J0YWwvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yaz9hcGktdmVyc2lvbj0yMDE5LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh3\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh4\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh5\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke3\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke4\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke5\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke6\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke7\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke8\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke9\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke10\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke11\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke12\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke13\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke14\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke15\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Hub\"\r\n }\r\n ]\r\n }\r\n },\r\n \"location\": \"Central US\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "bc382eef-0ced-4e61-ac23-e015618a7f03" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "3704" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "01980154-d897-4803-9ca1-1d462c1403cd" + ], + "x-ms-correlation-request-id": [ + "01980154-d897-4803-9ca1-1d462c1403cd" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232230Z:01980154-d897-4803-9ca1-1d462c1403cd" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:29 GMT" + ], + "Content-Length": [ + "3356" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork\",\r\n \"name\": \"myManagedNetwork\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"Central US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh3\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh4\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh5\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke3\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke4\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke5\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke6\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke7\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke8\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke9\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke10\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke11\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke12\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke13\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke14\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke15\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Hub\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": []\r\n }\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/myManagedNetwork?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQy1Qb3J0YWwvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvbXlNYW5hZ2VkTmV0d29yaz9hcGktdmVyc2lvbj0yMDE5LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "0647174b-0f0b-4390-9cac-51ea3b5232fc" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14998" + ], + "x-ms-request-id": [ + "170e8bc9-c342-4eb5-85fd-106d7c9bf9ed" + ], + "x-ms-correlation-request-id": [ + "170e8bc9-c342-4eb5-85fd-106d7c9bf9ed" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232231Z:170e8bc9-c342-4eb5-85fd-106d7c9bf9ed" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:30 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0c8037cf-745c-47eb-94f0-565cb9250814" + } +} \ No newline at end of file diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.Tests/HubSpoke.json b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.Tests/HubSpoke.json new file mode 100644 index 0000000000000..0e53be8b6b50c --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.Tests/HubSpoke.json @@ -0,0 +1,275 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourcegroups/MNC-Portal?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlZ3JvdXBzL01OQy1Qb3J0YWw/YXBpLXZlcnNpb249MjAxNS0xMS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "15fac9ca-347f-4b16-9e2f-2e30c231e3b2" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14999" + ], + "x-ms-request-id": [ + "0bd54a79-b062-4169-9a42-cdb6e0404638" + ], + "x-ms-correlation-request-id": [ + "0bd54a79-b062-4169-9a42-cdb6e0404638" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232233Z:0bd54a79-b062-4169-9a42-cdb6e0404638" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:33 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "176" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal\",\r\n \"name\": \"MNC-Portal\",\r\n \"location\": \"centralus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/Portal_ManagedNetwork9?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQy1Qb3J0YWwvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvUG9ydGFsX01hbmFnZWROZXR3b3JrOT9hcGktdmVyc2lvbj0yMDE5LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke3\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Hub\"\r\n }\r\n ]\r\n }\r\n },\r\n \"location\": \"Central US\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "764bb27d-8dc2-4d79-b9e9-4101448d2f1a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "793" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1192" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "84857e27-a409-4dbf-a0a8-50f0f64a3342" + ], + "x-ms-correlation-request-id": [ + "84857e27-a409-4dbf-a0a8-50f0f64a3342" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232235Z:84857e27-a409-4dbf-a0a8-50f0f64a3342" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:34 GMT" + ], + "Content-Length": [ + "1018" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/Portal_ManagedNetwork9\",\r\n \"name\": \"Portal_ManagedNetwork9\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"Central US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke3\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Hub\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": []\r\n }\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/Portal_ManagedNetwork9/managedNetworkGroups/Portal_SpokeGroup1?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQy1Qb3J0YWwvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvUG9ydGFsX01hbmFnZWROZXR3b3JrOS9tYW5hZ2VkTmV0d29ya0dyb3Vwcy9Qb3J0YWxfU3Bva2VHcm91cDE/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke3\"\r\n }\r\n ]\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "162bc8a7-bb03-4f14-a64d-3d0aa825a298" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "552" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1191" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "32861041-33fe-4ef6-bdae-819bd5862c72" + ], + "x-ms-correlation-request-id": [ + "32861041-33fe-4ef6-bdae-819bd5862c72" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232237Z:32861041-33fe-4ef6-bdae-819bd5862c72" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:36 GMT" + ], + "Content-Length": [ + "862" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/Portal_ManagedNetwork9/managedNetworkGroups/Portal_SpokeGroup1\",\r\n \"name\": \"Portal_SpokeGroup1\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke3\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/Portal_ManagedNetwork9/managedNetworkPeeringPolicies/SDK_MeshPolicy3?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQy1Qb3J0YWwvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvUG9ydGFsX01hbmFnZWROZXR3b3JrOS9tYW5hZ2VkTmV0d29ya1BlZXJpbmdQb2xpY2llcy9TREtfTWVzaFBvbGljeTM/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"type\": \"HubAndSpokeTopology\",\r\n \"hub\": {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Hub\"\r\n },\r\n \"spokes\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/Portal_ManagedNetwork9/managedNetworkGroups/Portal_SpokeGroup1\"\r\n }\r\n ]\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "a22d5914-ee7d-494f-84e7-d054897956dc" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "476" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1190" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "aa28d5ee-4cbc-4eb1-9ee3-4a5f433acfca" + ], + "x-ms-correlation-request-id": [ + "aa28d5ee-4cbc-4eb1-9ee3-4a5f433acfca" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232238Z:aa28d5ee-4cbc-4eb1-9ee3-4a5f433acfca" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:37 GMT" + ], + "Content-Length": [ + "759" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/Portal_ManagedNetwork9/managedNetworkPeeringPolicies/SDK_MeshPolicy3\",\r\n \"name\": \"SDK_MeshPolicy3\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkPeeringPolicies\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"type\": 1,\r\n \"hub\": {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Hub\"\r\n },\r\n \"spokes\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/Portal_ManagedNetwork9/managedNetworkGroups/Portal_SpokeGroup1\"\r\n }\r\n ],\r\n \"mesh\": []\r\n }\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0c8037cf-745c-47eb-94f0-565cb9250814" + } +} \ No newline at end of file diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.Tests/Mesh.json b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.Tests/Mesh.json new file mode 100644 index 0000000000000..546856f58378e --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/SessionRecords/ManagedNetwork.Tests.Tests/Mesh.json @@ -0,0 +1,275 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourcegroups/MNC-Portal?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlZ3JvdXBzL01OQy1Qb3J0YWw/YXBpLXZlcnNpb249MjAxNS0xMS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "6fa5501c-5d21-4bee-a1e4-1ee49d61699b" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14991" + ], + "x-ms-request-id": [ + "9856d854-1a2b-4a2f-8a3a-c02ca8060049" + ], + "x-ms-correlation-request-id": [ + "9856d854-1a2b-4a2f-8a3a-c02ca8060049" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232221Z:9856d854-1a2b-4a2f-8a3a-c02ca8060049" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:20 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "176" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal\",\r\n \"name\": \"MNC-Portal\",\r\n \"location\": \"centralus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/SDK_ManagedNetwork_Mesh1?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQy1Qb3J0YWwvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvU0RLX01hbmFnZWROZXR3b3JrX01lc2gxP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh3\"\r\n }\r\n ]\r\n }\r\n },\r\n \"location\": \"Central US\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "66fec300-ed44-49a2-9fd3-4bc7198f1e11" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "635" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1197" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "f006de92-d779-45d1-b4b0-3d09f2a62675" + ], + "x-ms-correlation-request-id": [ + "f006de92-d779-45d1-b4b0-3d09f2a62675" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232223Z:f006de92-d779-45d1-b4b0-3d09f2a62675" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:23 GMT" + ], + "Content-Length": [ + "897" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/SDK_ManagedNetwork_Mesh1\",\r\n \"name\": \"SDK_ManagedNetwork_Mesh1\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworks\",\r\n \"location\": \"Central US\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"scope\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh3\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n },\r\n \"connectivity\": {\r\n \"peerings\": [],\r\n \"groups\": []\r\n }\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/SDK_ManagedNetwork_Mesh1/managedNetworkGroups/SDK_MeshGroup?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQy1Qb3J0YWwvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvU0RLX01hbmFnZWROZXR3b3JrX01lc2gxL21hbmFnZWROZXR3b3JrR3JvdXBzL1NES19NZXNoR3JvdXA/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh3\"\r\n }\r\n ]\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "845633f4-53ca-41c6-a513-5c474e3d579c" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "561" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "3478e3bb-3649-4074-a20c-f4eeff243b45" + ], + "x-ms-correlation-request-id": [ + "3478e3bb-3649-4074-a20c-f4eeff243b45" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232224Z:3478e3bb-3649-4074-a20c-f4eeff243b45" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:24 GMT" + ], + "Content-Length": [ + "863" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/SDK_ManagedNetwork_Mesh1/managedNetworkGroups/SDK_MeshGroup\",\r\n \"name\": \"SDK_MeshGroup\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkGroups\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"virtualNetworks\": [\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh1\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh2\"\r\n },\r\n {\r\n \"id\": \"subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh3\"\r\n }\r\n ],\r\n \"managementGroups\": [],\r\n \"subscriptions\": [],\r\n \"subNets\": []\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/SDK_ManagedNetwork_Mesh1/managedNetworkPeeringPolicies/SDK_MeshPolicy?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MDM3Y2YtNzQ1Yy00N2ViLTk0ZjAtNTY1Y2I5MjUwODE0L3Jlc291cmNlR3JvdXBzL01OQy1Qb3J0YWwvcHJvdmlkZXJzL01pY3Jvc29mdC5NYW5hZ2VkTmV0d29yay9tYW5hZ2VkTmV0d29ya3MvU0RLX01hbmFnZWROZXR3b3JrX01lc2gxL21hbmFnZWROZXR3b3JrUGVlcmluZ1BvbGljaWVzL1NES19NZXNoUG9saWN5P2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"type\": \"MeshTopology\",\r\n \"mesh\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/SDK_ManagedNetwork_Mesh1/managedNetworkGroups/SDK_MeshGroup\"\r\n }\r\n ]\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "a5df52f2-17a8-4f93-ab93-74c3016ae0e7" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.27817.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18362.", + "Microsoft.Azure.Management.ManagedNetwork.ManagedNetworkManagementClient/1.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "302" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1195" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Server": [ + "Kestrel" + ], + "x-ms-request-id": [ + "b2fb3bb5-1ae9-4afe-8e1a-cad410832195" + ], + "x-ms-correlation-request-id": [ + "b2fb3bb5-1ae9-4afe-8e1a-cad410832195" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20190826T232226Z:b2fb3bb5-1ae9-4afe-8e1a-cad410832195" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Mon, 26 Aug 2019 23:22:25 GMT" + ], + "Content-Length": [ + "627" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/SDK_ManagedNetwork_Mesh1/managedNetworkPeeringPolicies/SDK_MeshPolicy\",\r\n \"name\": \"SDK_MeshPolicy\",\r\n \"type\": \"Microsoft.ManagedNetwork/managedNetworkPeeringPolicies\",\r\n \"location\": \"\",\r\n \"apiVersion\": \"\",\r\n \"tags\": [],\r\n \"resourceGuid\": \"\",\r\n \"provisioningState\": 0,\r\n \"properties\": {\r\n \"type\": 2,\r\n \"hub\": null,\r\n \"spokes\": [],\r\n \"mesh\": [\r\n {\r\n \"id\": \"subscriptions/0c8037cf-745c-47eb-94f0-565cb9250814/resourceGroups/MNC-Portal/providers/Microsoft.ManagedNetwork/managedNetworks/SDK_ManagedNetwork_Mesh1/managedNetworkGroups/SDK_MeshGroup\"\r\n }\r\n ]\r\n }\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0c8037cf-745c-47eb-94f0-565cb9250814" + } +} \ No newline at end of file diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Tests/ManagedNetworkGroupTests.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Tests/ManagedNetworkGroupTests.cs new file mode 100644 index 0000000000000..d9af94a346c04 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Tests/ManagedNetworkGroupTests.cs @@ -0,0 +1,113 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// +// +// +// Runs tests on Managed Network operations. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace ManagedNetwork.Tests +{ + using System; + using System.Collections.Generic; + using ManagedNetwork.Tests.Helpers; + using Microsoft.Azure.Management.ManagedNetwork; + using Microsoft.Azure.Management.ManagedNetwork.Models; + using Microsoft.Azure.Management.Resources; + using Microsoft.Azure.Management.Resources.Models; + using Microsoft.Rest.ClientRuntime.Azure.TestFramework; + + using Xunit; + + public class ManagedNetworkGroupTests + { + public ManagedNetworkManagementClient client { get; set; } + public ResourceManagementClient resourcesClient { get; set; } + + [Fact] + public void ManagedNetworkGroupTest() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + #region Initialization + this.client = context.GetServiceClient(); + this.resourcesClient = context.GetServiceClient(); + + string resourceGroupName = TestUtilities.GenerateName("MNCRP_RSG"); + string location = "West US"; + + ResourceGroup rsg; + try + { + rsg = this.resourcesClient.ResourceGroups.Get(resourceGroupName); + } + catch + { + rsg = this.resourcesClient.ResourceGroups.CreateOrUpdate(resourceGroupName, + new ResourceGroup + { + Location = location + }); + } + Assert.Equal(rsg.Name, resourceGroupName); + #endregion + + #region Create managedNetwork + string managedNetworkName = TestUtilities.GenerateName("myManagedNetwork"); + ManagedNetworkModel managedNetwork = new ManagedNetworkModel() + { + Location = location, + Scope = new Scope() + { + VirtualNetworks = new List(){ + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2" + }, + new ResourceId() + { + Id = "subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet" + } + }, + } + }; + // Put ManagedNetwork + ManagedNetworkModel putManagedNetworkResponse = this.client.ManagedNetworks.CreateOrUpdate(managedNetwork, resourceGroupName, managedNetworkName); + #endregion + + string managedNetworkGroupName = TestUtilities.GenerateName("myGroup"); + ManagedNetworkGroup managedNetworkGroup = new ManagedNetworkGroup() + { + VirtualNetworks = new List() + { + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2" + }, + new ResourceId() + { + Id = "subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet" + } + } + }; + ManagedNetworkGroup putManagedNetworkGroup = this.client.ManagedNetworkGroups.CreateOrUpdate(managedNetworkGroup, resourceGroupName, managedNetworkName, managedNetworkGroupName); + Comparator.CompareManagedNetworkGroup(managedNetworkGroup, putManagedNetworkGroup); + + ManagedNetworkGroup getManagedNetworkGroup = this.client.ManagedNetworkGroups.Get(resourceGroupName, managedNetworkName, managedNetworkGroupName); + Comparator.CompareManagedNetworkGroup(managedNetworkGroup, getManagedNetworkGroup); + + ManagedNetworkModel getManagedNetworkResponse = this.client.ManagedNetworks.Get(resourceGroupName, managedNetworkName); + Comparator.CompareManagedNetworkGroup(managedNetworkGroup, getManagedNetworkResponse.Connectivity.Groups[0]); + + var listManagedNetworkGroupResponse = this.client.ManagedNetworkGroups.ListByManagedNetwork(resourceGroupName, managedNetworkName); + Assert.Single(listManagedNetworkGroupResponse); + } + + } + } +} \ No newline at end of file diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Tests/ManagedNetworkTests.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Tests/ManagedNetworkTests.cs new file mode 100644 index 0000000000000..faee5efad420b --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Tests/ManagedNetworkTests.cs @@ -0,0 +1,97 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// +// +// +// Defines the PeeringTests type. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace ManagedNetwork.Tests +{ + using System.Collections.Generic; + + using Microsoft.Azure.Management.ManagedNetwork; + using Microsoft.Azure.Management.ManagedNetwork.Models; + using ManagedNetwork.Tests.Helpers; + using Microsoft.Azure.Management.Resources; + using Microsoft.Azure.Management.Resources.Models; + using Microsoft.Rest.ClientRuntime.Azure.TestFramework; + + using Xunit; + + + public class ManagedNetworkTests + { + + public ManagedNetworkManagementClient client { get; set; } + public ResourceManagementClient resourcesClient { get; set; } + + [Fact] + public void ManagedNetworkTest() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + #region Initialization + this.client = context.GetServiceClient(); + this.resourcesClient = context.GetServiceClient(); + + string resourceGroupName = TestUtilities.GenerateName("MNCRP_RSG"); + string location = "Central US"; + + ResourceGroup rsg; + try + { + rsg = this.resourcesClient.ResourceGroups.Get(resourceGroupName); + } + catch + { + rsg = this.resourcesClient.ResourceGroups.CreateOrUpdate(resourceGroupName, + new ResourceGroup + { + Location = location + }); + } + Assert.Equal(rsg.Name, resourceGroupName); + #endregion + + #region Create managedNetwork + string managedNetworkName = TestUtilities.GenerateName("myManagedNetwork"); + ManagedNetworkModel managedNetwork = new ManagedNetworkModel() + { + Location = location, + Scope = new Scope() + { + ManagementGroups = new List(), + Subscriptions = new List(), + VirtualNetworks = new List(){ + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet" + } + }, + Subnets = new List(), + } + }; + #endregion + + // Put ManagedNetwork + ManagedNetworkModel putManagedNetworkResponse = this.client.ManagedNetworks.CreateOrUpdate(managedNetwork, resourceGroupName, managedNetworkName); + Assert.NotNull(putManagedNetworkResponse); + Comparator.CompareManagedNetwork(managedNetwork, putManagedNetworkResponse); + + + // Get ManagedNetwork + ManagedNetworkModel getManagedNetworkResponse = this.client.ManagedNetworks.Get(resourceGroupName, managedNetworkName); + Comparator.CompareManagedNetwork(managedNetwork, getManagedNetworkResponse); + + var listManagedNetworkResponse = this.client.ManagedNetworks.ListBySubscription(); + Assert.NotEmpty(listManagedNetworkResponse); + + this.client.ManagedNetworks.Delete(resourceGroupName, managedNetworkName); + listManagedNetworkResponse = this.client.ManagedNetworks.ListByResourceGroup(resourceGroupName); + Assert.Empty(listManagedNetworkResponse); + } + } + } +} \ No newline at end of file diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Tests/PeeringPolicyTests.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Tests/PeeringPolicyTests.cs new file mode 100644 index 0000000000000..cc6ec0a45f1ff --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Tests/PeeringPolicyTests.cs @@ -0,0 +1,155 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// +// +// +// Runs tests on Managed Network operations. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace ManagedNetwork.Tests +{ + using System.Collections.Generic; + using ManagedNetwork.Tests.Helpers; + using Microsoft.Azure.Management.ManagedNetwork; + using Microsoft.Azure.Management.ManagedNetwork.Models; + using Microsoft.Azure.Management.Resources; + using Microsoft.Azure.Management.Resources.Models; + using Microsoft.Rest.ClientRuntime.Azure.TestFramework; + + using Xunit; + + + + + public class PeeringPolicyTests + { + public ManagedNetworkManagementClient client { get; set; } + public ResourceManagementClient resourcesClient { get; set; } + + [Fact] + public void ManagedNetworkGroupTest() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + #region Initialization + this.client = context.GetServiceClient(); + this.resourcesClient = context.GetServiceClient(); + + string resourceGroupName = TestUtilities.GenerateName("MNCRP_RSG"); + string location = "West US"; + + ResourceGroup rsg; + try + { + rsg = this.resourcesClient.ResourceGroups.Get(resourceGroupName); + } + catch + { + rsg = this.resourcesClient.ResourceGroups.CreateOrUpdate(resourceGroupName, + new ResourceGroup + { + Location = location + }); + } + Assert.Equal(rsg.Name, resourceGroupName); + #endregion + + #region Create managedNetwork + string managedNetworkName = TestUtilities.GenerateName("myManagedNetwork"); + ManagedNetworkModel managedNetwork = new ManagedNetworkModel() + { + Location = location, + Scope = new Scope() + { + VirtualNetworks = new List(){ + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2" + }, + new ResourceId() + { + Id = "subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet" + } + }, + } + }; + // Put ManagedNetwork + this.client.ManagedNetworks.CreateOrUpdate(managedNetwork, resourceGroupName, managedNetworkName); + // Create Connectivity Group + string managedNetworkGroupName = TestUtilities.GenerateName("myGroup"); + ManagedNetworkGroup managedNetworkGroup = new ManagedNetworkGroup() + { + VirtualNetworks = new List() + { + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet2" + }, + new ResourceId() + { + Id = "subscriptions/6bb4a28a-db84-4e8a-b1dc-fabf7bd9f0b2/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/NewTestVNet" + } + } + }; + // Put Connectivity Group + ManagedNetworkGroup putConnectivityGroupResponse = this.client.ManagedNetworkGroups.CreateOrUpdate(managedNetworkGroup, resourceGroupName, managedNetworkName, managedNetworkGroupName); + #endregion + + #region Create peeringPolicy + string peeringPolicyName = TestUtilities.GenerateName("hubAndSpoke"); + ResourceId hub = new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNCRG/providers/Microsoft.Network/virtualnetworks/testvnet" + }; + + var spokes = new List + { + new ResourceId() + { + Id = putConnectivityGroupResponse.Id + }, + }; + + ManagedNetworkPeeringPolicyProperties managedNetworkPeeringPolicyProperties = new ManagedNetworkPeeringPolicyProperties + { + Type = "HubAndSpokeTopology", + Hub = hub, + Spokes = spokes + }; + + ManagedNetworkPeeringPolicy peeringPolicy = new ManagedNetworkPeeringPolicy + { + Properties = managedNetworkPeeringPolicyProperties + }; + #endregion + + // Put PeeringPolicy + ManagedNetworkPeeringPolicy putPeeringPolicyResult = this.client.ManagedNetworkPeeringPolicies.CreateOrUpdate(peeringPolicy, resourceGroupName, managedNetworkName, peeringPolicyName); + Assert.NotNull(putPeeringPolicyResult); + Comparator.ComparePeeringPolicy(peeringPolicy, putPeeringPolicyResult); + + // Get PeeringPolicy + ManagedNetworkPeeringPolicy getPeeringPolicyResult = this.client.ManagedNetworkPeeringPolicies.Get(resourceGroupName, managedNetworkName, peeringPolicyName); + Comparator.ComparePeeringPolicy(peeringPolicy, getPeeringPolicyResult); + + //Get PeeringPolicy from ManagedNetwork + ManagedNetworkModel getManagedNetworkResponse = this.client.ManagedNetworks.Get(resourceGroupName, managedNetworkName); + Comparator.ComparePeeringPolicy(peeringPolicy, getManagedNetworkResponse.Connectivity.Peerings[0]); + + //List PeeringPolicy from ManagedNetworkm + var listPeeringPolicyResponse = this.client.ManagedNetworkPeeringPolicies.ListByManagedNetwork(resourceGroupName, managedNetworkName); + Assert.Single(listPeeringPolicyResponse); + + //Delete PeeringPolicy + this.client.ManagedNetworkPeeringPolicies.Delete(resourceGroupName, managedNetworkName, peeringPolicyName); + + } + + } + } +} \ No newline at end of file diff --git a/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Tests/Test.cs b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Tests/Test.cs new file mode 100644 index 0000000000000..2b98cee798363 --- /dev/null +++ b/sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork/tests/Tests/Test.cs @@ -0,0 +1,393 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// +// +// +// Runs tests on Managed Network operations. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace ManagedNetwork.Tests +{ + using System.Collections.Generic; + using Microsoft.Azure.Management.Resources; + using Microsoft.Azure.Management.Resources.Models; + using Microsoft.Azure.Management.ManagedNetwork; + using Microsoft.Azure.Management.ManagedNetwork.Models; + using Microsoft.Rest.ClientRuntime.Azure.TestFramework; + using Xunit; + + public class Tests + { + public ManagedNetworkManagementClient client { get; set; } + public ResourceManagementClient resourcesClient { get; set; } + + [Fact] + public void Mesh() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + #region Initialization + this.client = context.GetServiceClient(); + this.resourcesClient = context.GetServiceClient(); + string resourceGroupName = "MNC-Portal"; + string location = "Central US"; + + ResourceGroup rsg; + try + { + rsg = this.resourcesClient.ResourceGroups.Get(resourceGroupName); + } + catch + { + rsg = this.resourcesClient.ResourceGroups.CreateOrUpdate(resourceGroupName, + new ResourceGroup + { + Location = location + }); + } + Assert.Equal(rsg.Name, resourceGroupName); + #endregion + + #region Create managedNetwork + string managedNetworkName = "SDK_ManagedNetwork_Mesh1"; + Scope mNScope = new Scope() + { + VirtualNetworks = new List() + { + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh1" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh2" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh3" + } + } + }; + + ManagedNetworkModel managedNetwork = new ManagedNetworkModel() + { + Location = location, + Scope = mNScope + }; + + ManagedNetworkModel putManagedNetworkResponse = this.client.ManagedNetworks.CreateOrUpdate(managedNetwork, resourceGroupName, managedNetworkName); + #endregion + string managedNetworkGroupName = "SDK_MeshGroup"; + + ManagedNetworkGroup managedNetworkGroup = new ManagedNetworkGroup() + { + VirtualNetworks = new List() + { + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh1" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh2" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh3" + } + } + }; + // Put Connectivity Group + ManagedNetworkGroup putManagedNetworkGroupResponse = this.client.ManagedNetworkGroups.CreateOrUpdate(managedNetworkGroup, resourceGroupName, managedNetworkName, managedNetworkGroupName); + + #region Create peeringPolicy + string peeringPolicyName = "SDK_MeshPolicy"; + + string managedNetworkPeeringPolicyType = "MeshTopology"; + var mesh = new List + { + new ResourceId() + { + Id = putManagedNetworkGroupResponse.Id + }, + }; + + + ManagedNetworkPeeringPolicyProperties managedNetworkPeeringPolicyProperties = new ManagedNetworkPeeringPolicyProperties + { + Type = managedNetworkPeeringPolicyType, + Mesh = mesh + }; + + ManagedNetworkPeeringPolicy peeringPolicy = new ManagedNetworkPeeringPolicy + { + Properties = managedNetworkPeeringPolicyProperties + }; + #endregion + // Put PeeringPolicy + ManagedNetworkPeeringPolicy putPeeringPolicyResult = this.client.ManagedNetworkPeeringPolicies.CreateOrUpdate(peeringPolicy, resourceGroupName, managedNetworkName, peeringPolicyName); + } + + } + + [Fact] + public void HubSpoke() + { + var mode = System.Environment.GetEnvironmentVariable("AZURE_TEST_MODE"); + var connectionstring = System.Environment.GetEnvironmentVariable("TEST_CSM_ORGID_AUTHENTICATION"); + using (var context = MockContext.Start(this.GetType().FullName)) + { + #region Initialization + this.client = context.GetServiceClient(); + this.resourcesClient = context.GetServiceClient(); + string resourceGroupName = "MNC-Portal"; + string location = "Central US"; + + ResourceGroup rsg; + try + { + rsg = this.resourcesClient.ResourceGroups.Get(resourceGroupName); + } + catch + { + rsg = this.resourcesClient.ResourceGroups.CreateOrUpdate(resourceGroupName, + new ResourceGroup + { + Location = location + }); + } + Assert.Equal(rsg.Name, resourceGroupName); + #endregion + + #region Create managedNetwork + string managedNetworkName = "Portal_ManagedNetwork9"; + + Scope scope = new Scope() + { + VirtualNetworks = new List() + { + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke1" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke2" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke3" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Hub" + } + } + }; + + ManagedNetworkModel managedNetwork = new ManagedNetworkModel() + { + Location = location, + Scope = scope + }; + + ManagedNetworkModel putManagedNetworkResponse = this.client.ManagedNetworks.CreateOrUpdate(managedNetwork, resourceGroupName, managedNetworkName); + #endregion + + + + string managedNetworkGroupName = "Portal_SpokeGroup1"; + ManagedNetworkGroup managedNetworkGroup = new ManagedNetworkGroup() + { + VirtualNetworks = new List() + { + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke1" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke2" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke3" + } + } + }; + // Put Connectivity Group + ManagedNetworkGroup putManagedNetworkGroupResponse = this.client.ManagedNetworkGroups.CreateOrUpdate(managedNetworkGroup, resourceGroupName, managedNetworkName, managedNetworkGroupName); + + + + #region Create peeringPolicy + string peeringPolicyName = "SDK_MeshPolicy3"; + ResourceId hub = new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Hub" + }; + + var spokes = new List + { + new ResourceId() + { + Id = putManagedNetworkGroupResponse.Id + }, + }; + + ManagedNetworkPeeringPolicyProperties managedNetworkPeeringPolicyProperties = new ManagedNetworkPeeringPolicyProperties + { + Type = "HubAndSpokeTopology", + Hub = hub, + Spokes = spokes + }; + + ManagedNetworkPeeringPolicy peeringPolicy = new ManagedNetworkPeeringPolicy + { + Properties = managedNetworkPeeringPolicyProperties + }; + #endregion + + // Put PeeringPolicy + ManagedNetworkPeeringPolicy putPeeringPolicyResult = this.client.ManagedNetworkPeeringPolicies.CreateOrUpdate(peeringPolicy, resourceGroupName, managedNetworkName, peeringPolicyName); + + } + + } + + [Fact] + public void Clear() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + #region Initialization + this.client = context.GetServiceClient(); + this.resourcesClient = context.GetServiceClient(); + string resourceGroupName = "MNC-Portal"; + string location = "Central US"; + + ResourceGroup rsg; + try + { + rsg = this.resourcesClient.ResourceGroups.Get(resourceGroupName); + } + catch + { + rsg = this.resourcesClient.ResourceGroups.CreateOrUpdate(resourceGroupName, + new ResourceGroup + { + Location = location + }); + } + Assert.Equal(rsg.Name, resourceGroupName); + #endregion + #region Create managedNetwork + string managedNetworkName = "myManagedNetwork"; + + Scope scope = new Scope() + { + VirtualNetworks = new List() + { + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh1" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh2" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh3" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh4" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-PowerShell/providers/Microsoft.Network/virtualnetworks/Mesh5" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke1" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke2" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke3" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke4" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke5" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke6" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke7" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke8" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke9" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke10" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke11" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke12" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke13" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke14" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Spoke15" + }, + new ResourceId() + { + Id = "subscriptions/18ba8369-92e4-4d70-8b1e-937660bde798/resourceGroups/MNC-Portal/providers/Microsoft.Network/virtualNetworks/Hub" + }, + } + }; + + ManagedNetworkModel managedNetwork = new ManagedNetworkModel() + { + Location = location, + Scope = scope + }; + + ManagedNetworkModel putManagedNetworkResponse = this.client.ManagedNetworks.CreateOrUpdate(managedNetwork, resourceGroupName, managedNetworkName); + #endregion + + this.client.ManagedNetworks.Delete(resourceGroupName, managedNetworkName); + } + + } + } +} \ No newline at end of file