From fa64eee3f31b431badf1f47f5cfeeb4d4101798c Mon Sep 17 00:00:00 2001 From: Jingshu923 <52914166+Jingshu923@users.noreply.github.com> Date: Fri, 21 Aug 2020 05:38:09 +0800 Subject: [PATCH] SDK code change 0818 (#14296) --- .../datafactory_resource-manager.txt | 4 +- .../src/CHANGELOG.md | 5 + .../Generated/DataFactoryManagementClient.cs | 12 + .../Generated/ExposureControlOperations.cs | 244 +++ .../ExposureControlOperationsExtensions.cs | 46 + .../Generated/IDataFactoryManagementClient.cs | 10 + .../Generated/IExposureControlOperations.cs | 28 + .../IManagedPrivateEndpointsOperations.cs | 180 +++ .../IManagedVirtualNetworksOperations.cs | 143 ++ .../ManagedPrivateEndpointsOperations.cs | 1324 +++++++++++++++++ ...gedPrivateEndpointsOperationsExtensions.cs | 284 ++++ .../ManagedVirtualNetworksOperations.cs | 999 +++++++++++++ ...agedVirtualNetworksOperationsExtensions.cs | 217 +++ .../Models/AzureFileStorageWriteSettings.cs | 54 + .../Models/ConnectionStateProperties.cs | 69 + .../Generated/Models/CosmosDbSqlApiSource.cs | 13 +- .../Models/ExposureControlBatchRequest.cs | 70 + .../Models/ExposureControlBatchResponse.cs | 70 + .../src/Generated/Models/HdfsReadSettings.cs | 15 +- .../Models/ManagedPrivateEndpoint.cs | 110 ++ .../Models/ManagedPrivateEndpointResource.cs | 73 + .../Generated/Models/ManagedVirtualNetwork.cs | 71 + .../Models/ManagedVirtualNetworkResource.cs | 73 + .../src/Generated/Models/XmlReadSettings.cs | 26 +- ...rosoft.Azure.Management.DataFactory.csproj | 5 + .../ManagedPrivateEndpointJsonSamples.cs | 34 + .../ManagedVirtualNetworkJsonSamples.cs | 14 + .../tests/JsonSamples/PipelineJsonSamples.cs | 3 +- .../ManagedPrivateEndpoints_Create.json | 46 + .../ManagedPrivateEndpoints_Delete.json | 14 + .../TestData/ManagedPrivateEndpoints_Get.json | 39 + ...ManagedPrivateEndpoints_ListByFactory.json | 42 + .../ManagedVirtualNetworks_Create.json | 34 + .../TestData/ManagedVirtualNetworks_Get.json | 31 + .../ManagedVirtualNetworks_ListByFactory.json | 34 + .../tests/UnitTests/ExamplesUnitTest.cs | 87 ++ .../UnitTests/ManagedPrivateEndpointTests.cs | 53 + .../UnitTests/ManagedVirtualNetworkTests.cs | 33 + 38 files changed, 4603 insertions(+), 6 deletions(-) create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IManagedPrivateEndpointsOperations.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IManagedVirtualNetworksOperations.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedPrivateEndpointsOperations.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedPrivateEndpointsOperationsExtensions.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedVirtualNetworksOperations.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedVirtualNetworksOperationsExtensions.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureFileStorageWriteSettings.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ConnectionStateProperties.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ExposureControlBatchRequest.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ExposureControlBatchResponse.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedPrivateEndpoint.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedPrivateEndpointResource.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedVirtualNetwork.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedVirtualNetworkResource.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/ManagedPrivateEndpointJsonSamples.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/ManagedVirtualNetworkJsonSamples.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_Create.json create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_Delete.json create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_Get.json create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_ListByFactory.json create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedVirtualNetworks_Create.json create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedVirtualNetworks_Get.json create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedVirtualNetworks_ListByFactory.json create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ManagedPrivateEndpointTests.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ManagedVirtualNetworkTests.cs diff --git a/eng/mgmt/mgmtmetadata/datafactory_resource-manager.txt b/eng/mgmt/mgmtmetadata/datafactory_resource-manager.txt index 26811d693022..3764f4d232e6 100644 --- a/eng/mgmt/mgmtmetadata/datafactory_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/datafactory_resource-manager.txt @@ -4,11 +4,11 @@ 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/datafactory/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --tag=package-2018-06 --csharp-sdks-folder=D:\Projects\azure-sdk-for-net\sdk -2020-07-30 05:05:28 UTC +2020-08-18 10:43:15 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: b8630cc7b5869fbb764eeca3a618b23141e612db +Commit: 271086fdddc2d13910e8fa1373d285b1512ed032 AutoRest information Requested version: v2 Bootstrapper version: autorest@2.0.4413 diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/CHANGELOG.md b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/CHANGELOG.md index 992ea8cf4dd7..5f7fbc33372e 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/CHANGELOG.md +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/CHANGELOG.md @@ -6,6 +6,11 @@ - Added column delimiter for SAP Table/open hub - Added azureCloudType for Aad Auth - Added snapshot to Azure File Storage linked service +- Support HDFS for delete activity and deleteFilesAfterCompletion feature in copy activity +- Added support for managed Virtual Network and managed private endpoint CRUD APIs +- Added Support for Query EC List API +- Added more options on XML and CosmosDbSqlApi copy source +- Fix bug: Added AzureFileStorageWriteSettings ## Version 4.10.0 ### Feature Additions diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs index 4576186b5cd9..028d20fc7a8a 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs @@ -150,6 +150,16 @@ public partial class DataFactoryManagementClient : ServiceClient public virtual IDataFlowDebugSessionOperations DataFlowDebugSession { get; private set; } + /// + /// Gets the IManagedVirtualNetworksOperations. + /// + public virtual IManagedVirtualNetworksOperations ManagedVirtualNetworks { get; private set; } + + /// + /// Gets the IManagedPrivateEndpointsOperations. + /// + public virtual IManagedPrivateEndpointsOperations ManagedPrivateEndpoints { get; private set; } + /// /// Initializes a new instance of the DataFactoryManagementClient class. /// @@ -406,6 +416,8 @@ private void Initialize() TriggerRuns = new TriggerRunsOperations(this); DataFlows = new DataFlowsOperations(this); DataFlowDebugSession = new DataFlowDebugSessionOperations(this); + ManagedVirtualNetworks = new ManagedVirtualNetworksOperations(this); + ManagedPrivateEndpoints = new ManagedPrivateEndpointsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); ApiVersion = "2018-06-01"; AcceptLanguage = "en-US"; diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ExposureControlOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ExposureControlOperations.cs index e31cffd39093..6dc9012af83c 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ExposureControlOperations.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ExposureControlOperations.cs @@ -491,5 +491,249 @@ internal ExposureControlOperations(DataFactoryManagementClient client) return _result; } + /// + /// Get list of exposure control features for specific factory. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The exposure control request for list of features. + /// + /// + /// 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> QueryFeatureValuesByFactoryWithHttpMessagesAsync(string resourceGroupName, string factoryName, ExposureControlBatchRequest exposureControlBatchRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (factoryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "factoryName"); + } + if (factoryName != null) + { + if (factoryName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "factoryName", 63); + } + if (factoryName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "factoryName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(factoryName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "factoryName", "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (exposureControlBatchRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exposureControlBatchRequest"); + } + if (exposureControlBatchRequest != null) + { + exposureControlBatchRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("factoryName", factoryName); + tracingParameters.Add("exposureControlBatchRequest", exposureControlBatchRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "QueryFeatureValuesByFactory", 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.DataFactory/factories/{factoryName}/queryFeaturesValue").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{factoryName}", System.Uri.EscapeDataString(factoryName)); + 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("POST"); + _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(exposureControlBatchRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(exposureControlBatchRequest, 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) + { + 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(); + } + // 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/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ExposureControlOperationsExtensions.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ExposureControlOperationsExtensions.cs index 94a171727890..f3e665981016 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ExposureControlOperationsExtensions.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ExposureControlOperationsExtensions.cs @@ -107,5 +107,51 @@ public static ExposureControlResponse GetFeatureValueByFactory(this IExposureCon } } + /// + /// Get list of exposure control features for specific factory. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The exposure control request for list of features. + /// + public static ExposureControlBatchResponse QueryFeatureValuesByFactory(this IExposureControlOperations operations, string resourceGroupName, string factoryName, ExposureControlBatchRequest exposureControlBatchRequest) + { + return operations.QueryFeatureValuesByFactoryAsync(resourceGroupName, factoryName, exposureControlBatchRequest).GetAwaiter().GetResult(); + } + + /// + /// Get list of exposure control features for specific factory. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The exposure control request for list of features. + /// + /// + /// The cancellation token. + /// + public static async Task QueryFeatureValuesByFactoryAsync(this IExposureControlOperations operations, string resourceGroupName, string factoryName, ExposureControlBatchRequest exposureControlBatchRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.QueryFeatureValuesByFactoryWithHttpMessagesAsync(resourceGroupName, factoryName, exposureControlBatchRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IDataFactoryManagementClient.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IDataFactoryManagementClient.cs index 6b3e521ca6b1..67c86fd83972 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IDataFactoryManagementClient.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IDataFactoryManagementClient.cs @@ -145,5 +145,15 @@ public partial interface IDataFactoryManagementClient : System.IDisposable /// IDataFlowDebugSessionOperations DataFlowDebugSession { get; } + /// + /// Gets the IManagedVirtualNetworksOperations. + /// + IManagedVirtualNetworksOperations ManagedVirtualNetworks { get; } + + /// + /// Gets the IManagedPrivateEndpointsOperations. + /// + IManagedPrivateEndpointsOperations ManagedPrivateEndpoints { get; } + } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IExposureControlOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IExposureControlOperations.cs index 8683404514fb..0239ca2e3ef5 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IExposureControlOperations.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IExposureControlOperations.cs @@ -76,5 +76,33 @@ public partial interface IExposureControlOperations /// Thrown when a required parameter is null /// Task> GetFeatureValueByFactoryWithHttpMessagesAsync(string resourceGroupName, string factoryName, ExposureControlRequest exposureControlRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get list of exposure control features for specific factory. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The exposure control request for list of features. + /// + /// + /// 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> QueryFeatureValuesByFactoryWithHttpMessagesAsync(string resourceGroupName, string factoryName, ExposureControlBatchRequest exposureControlBatchRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IManagedPrivateEndpointsOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IManagedPrivateEndpointsOperations.cs new file mode 100644 index 000000000000..1d84087cec77 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IManagedPrivateEndpointsOperations.cs @@ -0,0 +1,180 @@ +// +// 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.DataFactory +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedPrivateEndpointsOperations operations. + /// + public partial interface IManagedPrivateEndpointsOperations + { + /// + /// Lists managed private endpoints. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// 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>> ListByFactoryWithHttpMessagesAsync(string resourceGroupName, string factoryName, string managedVirtualNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a managed private endpoint. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed private endpoint name + /// + /// + /// Managed private endpoint resource definition. + /// + /// + /// ETag of the managed private endpoint entity. Should only be + /// specified for update, for which it should match existing entity or + /// can be * for unconditional update. + /// + /// + /// 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(string resourceGroupName, string factoryName, string managedVirtualNetworkName, string managedPrivateEndpointName, ManagedPrivateEndpointResource managedPrivateEndpoint, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a managed private endpoint. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed private endpoint name + /// + /// + /// ETag of the managed private endpoint entity. Should only be + /// specified for get. If the ETag matches the existing entity tag, or + /// if * was provided, then no content will be returned. + /// + /// + /// 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 factoryName, string managedVirtualNetworkName, string managedPrivateEndpointName, string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a managed private endpoint. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed private endpoint name + /// + /// + /// 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 factoryName, string managedVirtualNetworkName, string managedPrivateEndpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists managed private endpoints. + /// + /// + /// 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>> ListByFactoryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IManagedVirtualNetworksOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IManagedVirtualNetworksOperations.cs new file mode 100644 index 000000000000..ef05ffa5d2d4 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IManagedVirtualNetworksOperations.cs @@ -0,0 +1,143 @@ +// +// 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.DataFactory +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedVirtualNetworksOperations operations. + /// + public partial interface IManagedVirtualNetworksOperations + { + /// + /// Lists managed Virtual Networks. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// 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>> ListByFactoryWithHttpMessagesAsync(string resourceGroupName, string factoryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a managed Virtual Network. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed Virtual Network resource definition. + /// + /// + /// ETag of the managed Virtual Network entity. Should only be + /// specified for update, for which it should match existing entity or + /// can be * for unconditional update. + /// + /// + /// 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(string resourceGroupName, string factoryName, string managedVirtualNetworkName, ManagedVirtualNetworkResource managedVirtualNetwork, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a managed Virtual Network. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// ETag of the managed Virtual Network entity. Should only be + /// specified for get. If the ETag matches the existing entity tag, or + /// if * was provided, then no content will be returned. + /// + /// + /// 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 factoryName, string managedVirtualNetworkName, string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists managed Virtual Networks. + /// + /// + /// 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>> ListByFactoryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedPrivateEndpointsOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedPrivateEndpointsOperations.cs new file mode 100644 index 000000000000..8aa00ebbd03e --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedPrivateEndpointsOperations.cs @@ -0,0 +1,1324 @@ +// +// 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.DataFactory +{ + 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; + + /// + /// ManagedPrivateEndpointsOperations operations. + /// + internal partial class ManagedPrivateEndpointsOperations : IServiceOperations, IManagedPrivateEndpointsOperations + { + /// + /// Initializes a new instance of the ManagedPrivateEndpointsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedPrivateEndpointsOperations(DataFactoryManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataFactoryManagementClient + /// + public DataFactoryManagementClient Client { get; private set; } + + /// + /// Lists managed private endpoints. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// 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>> ListByFactoryWithHttpMessagesAsync(string resourceGroupName, string factoryName, string managedVirtualNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (factoryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "factoryName"); + } + if (factoryName != null) + { + if (factoryName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "factoryName", 63); + } + if (factoryName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "factoryName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(factoryName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "factoryName", "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"); + } + } + if (managedVirtualNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedVirtualNetworkName"); + } + if (managedVirtualNetworkName != null) + { + if (managedVirtualNetworkName.Length > 127) + { + throw new ValidationException(ValidationRules.MaxLength, "managedVirtualNetworkName", 127); + } + if (managedVirtualNetworkName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "managedVirtualNetworkName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(managedVirtualNetworkName, "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$")) + { + throw new ValidationException(ValidationRules.Pattern, "managedVirtualNetworkName", "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$"); + } + } + 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("resourceGroupName", resourceGroupName); + tracingParameters.Add("factoryName", factoryName); + tracingParameters.Add("managedVirtualNetworkName", managedVirtualNetworkName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByFactory", 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.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{factoryName}", System.Uri.EscapeDataString(factoryName)); + _url = _url.Replace("{managedVirtualNetworkName}", System.Uri.EscapeDataString(managedVirtualNetworkName)); + 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 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(); + } + // 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 or updates a managed private endpoint. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed private endpoint name + /// + /// + /// Managed private endpoint resource definition. + /// + /// + /// ETag of the managed private endpoint entity. Should only be specified for + /// update, for which it should match existing entity or can be * for + /// unconditional update. + /// + /// + /// 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(string resourceGroupName, string factoryName, string managedVirtualNetworkName, string managedPrivateEndpointName, ManagedPrivateEndpointResource managedPrivateEndpoint, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (factoryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "factoryName"); + } + if (factoryName != null) + { + if (factoryName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "factoryName", 63); + } + if (factoryName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "factoryName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(factoryName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "factoryName", "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"); + } + } + if (managedVirtualNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedVirtualNetworkName"); + } + if (managedVirtualNetworkName != null) + { + if (managedVirtualNetworkName.Length > 127) + { + throw new ValidationException(ValidationRules.MaxLength, "managedVirtualNetworkName", 127); + } + if (managedVirtualNetworkName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "managedVirtualNetworkName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(managedVirtualNetworkName, "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$")) + { + throw new ValidationException(ValidationRules.Pattern, "managedVirtualNetworkName", "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$"); + } + } + if (managedPrivateEndpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedPrivateEndpointName"); + } + if (managedPrivateEndpointName != null) + { + if (managedPrivateEndpointName.Length > 127) + { + throw new ValidationException(ValidationRules.MaxLength, "managedPrivateEndpointName", 127); + } + if (managedPrivateEndpointName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "managedPrivateEndpointName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(managedPrivateEndpointName, "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$")) + { + throw new ValidationException(ValidationRules.Pattern, "managedPrivateEndpointName", "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (managedPrivateEndpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedPrivateEndpoint"); + } + if (managedPrivateEndpoint != null) + { + managedPrivateEndpoint.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("factoryName", factoryName); + tracingParameters.Add("managedVirtualNetworkName", managedVirtualNetworkName); + tracingParameters.Add("managedPrivateEndpointName", managedPrivateEndpointName); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("managedPrivateEndpoint", managedPrivateEndpoint); + 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.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints/{managedPrivateEndpointName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{factoryName}", System.Uri.EscapeDataString(factoryName)); + _url = _url.Replace("{managedVirtualNetworkName}", System.Uri.EscapeDataString(managedVirtualNetworkName)); + _url = _url.Replace("{managedPrivateEndpointName}", System.Uri.EscapeDataString(managedPrivateEndpointName)); + 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 (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + 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(managedPrivateEndpoint != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(managedPrivateEndpoint, 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) + { + 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(); + } + // 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; + } + + /// + /// Gets a managed private endpoint. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed private endpoint name + /// + /// + /// ETag of the managed private endpoint entity. Should only be specified for + /// get. If the ETag matches the existing entity tag, or if * was provided, + /// then no content will be returned. + /// + /// + /// 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 factoryName, string managedVirtualNetworkName, string managedPrivateEndpointName, string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (factoryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "factoryName"); + } + if (factoryName != null) + { + if (factoryName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "factoryName", 63); + } + if (factoryName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "factoryName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(factoryName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "factoryName", "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"); + } + } + if (managedVirtualNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedVirtualNetworkName"); + } + if (managedVirtualNetworkName != null) + { + if (managedVirtualNetworkName.Length > 127) + { + throw new ValidationException(ValidationRules.MaxLength, "managedVirtualNetworkName", 127); + } + if (managedVirtualNetworkName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "managedVirtualNetworkName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(managedVirtualNetworkName, "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$")) + { + throw new ValidationException(ValidationRules.Pattern, "managedVirtualNetworkName", "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$"); + } + } + if (managedPrivateEndpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedPrivateEndpointName"); + } + if (managedPrivateEndpointName != null) + { + if (managedPrivateEndpointName.Length > 127) + { + throw new ValidationException(ValidationRules.MaxLength, "managedPrivateEndpointName", 127); + } + if (managedPrivateEndpointName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "managedPrivateEndpointName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(managedPrivateEndpointName, "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$")) + { + throw new ValidationException(ValidationRules.Pattern, "managedPrivateEndpointName", "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$"); + } + } + 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("resourceGroupName", resourceGroupName); + tracingParameters.Add("factoryName", factoryName); + tracingParameters.Add("managedVirtualNetworkName", managedVirtualNetworkName); + tracingParameters.Add("managedPrivateEndpointName", managedPrivateEndpointName); + tracingParameters.Add("ifNoneMatch", ifNoneMatch); + 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.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints/{managedPrivateEndpointName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{factoryName}", System.Uri.EscapeDataString(factoryName)); + _url = _url.Replace("{managedVirtualNetworkName}", System.Uri.EscapeDataString(managedVirtualNetworkName)); + _url = _url.Replace("{managedPrivateEndpointName}", System.Uri.EscapeDataString(managedPrivateEndpointName)); + 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 (ifNoneMatch != null) + { + if (_httpRequest.Headers.Contains("If-None-Match")) + { + _httpRequest.Headers.Remove("If-None-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-None-Match", ifNoneMatch); + } + 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(); + } + // 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; + } + + /// + /// Deletes a managed private endpoint. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed private endpoint name + /// + /// + /// 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 resourceGroupName, string factoryName, string managedVirtualNetworkName, string managedPrivateEndpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (factoryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "factoryName"); + } + if (factoryName != null) + { + if (factoryName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "factoryName", 63); + } + if (factoryName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "factoryName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(factoryName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "factoryName", "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"); + } + } + if (managedVirtualNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedVirtualNetworkName"); + } + if (managedVirtualNetworkName != null) + { + if (managedVirtualNetworkName.Length > 127) + { + throw new ValidationException(ValidationRules.MaxLength, "managedVirtualNetworkName", 127); + } + if (managedVirtualNetworkName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "managedVirtualNetworkName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(managedVirtualNetworkName, "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$")) + { + throw new ValidationException(ValidationRules.Pattern, "managedVirtualNetworkName", "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$"); + } + } + if (managedPrivateEndpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedPrivateEndpointName"); + } + if (managedPrivateEndpointName != null) + { + if (managedPrivateEndpointName.Length > 127) + { + throw new ValidationException(ValidationRules.MaxLength, "managedPrivateEndpointName", 127); + } + if (managedPrivateEndpointName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "managedPrivateEndpointName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(managedPrivateEndpointName, "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$")) + { + throw new ValidationException(ValidationRules.Pattern, "managedPrivateEndpointName", "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$"); + } + } + 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("resourceGroupName", resourceGroupName); + tracingParameters.Add("factoryName", factoryName); + tracingParameters.Add("managedVirtualNetworkName", managedVirtualNetworkName); + tracingParameters.Add("managedPrivateEndpointName", managedPrivateEndpointName); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints/{managedPrivateEndpointName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{factoryName}", System.Uri.EscapeDataString(factoryName)); + _url = _url.Replace("{managedVirtualNetworkName}", System.Uri.EscapeDataString(managedVirtualNetworkName)); + _url = _url.Replace("{managedPrivateEndpointName}", System.Uri.EscapeDataString(managedPrivateEndpointName)); + 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 != 204) + { + 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; + } + + /// + /// Lists managed private endpoints. + /// + /// + /// 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>> ListByFactoryNextWithHttpMessagesAsync(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, "ListByFactoryNext", 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 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(); + } + // 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/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedPrivateEndpointsOperationsExtensions.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedPrivateEndpointsOperationsExtensions.cs new file mode 100644 index 000000000000..4edfa1de0352 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedPrivateEndpointsOperationsExtensions.cs @@ -0,0 +1,284 @@ +// +// 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.DataFactory +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedPrivateEndpointsOperations. + /// + public static partial class ManagedPrivateEndpointsOperationsExtensions + { + /// + /// Lists managed private endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + public static IPage ListByFactory(this IManagedPrivateEndpointsOperations operations, string resourceGroupName, string factoryName, string managedVirtualNetworkName) + { + return operations.ListByFactoryAsync(resourceGroupName, factoryName, managedVirtualNetworkName).GetAwaiter().GetResult(); + } + + /// + /// Lists managed private endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByFactoryAsync(this IManagedPrivateEndpointsOperations operations, string resourceGroupName, string factoryName, string managedVirtualNetworkName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByFactoryWithHttpMessagesAsync(resourceGroupName, factoryName, managedVirtualNetworkName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a managed private endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed private endpoint name + /// + /// + /// Managed private endpoint resource definition. + /// + /// + /// ETag of the managed private endpoint entity. Should only be specified for + /// update, for which it should match existing entity or can be * for + /// unconditional update. + /// + public static ManagedPrivateEndpointResource CreateOrUpdate(this IManagedPrivateEndpointsOperations operations, string resourceGroupName, string factoryName, string managedVirtualNetworkName, string managedPrivateEndpointName, ManagedPrivateEndpointResource managedPrivateEndpoint, string ifMatch = default(string)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, factoryName, managedVirtualNetworkName, managedPrivateEndpointName, managedPrivateEndpoint, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a managed private endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed private endpoint name + /// + /// + /// Managed private endpoint resource definition. + /// + /// + /// ETag of the managed private endpoint entity. Should only be specified for + /// update, for which it should match existing entity or can be * for + /// unconditional update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagedPrivateEndpointsOperations operations, string resourceGroupName, string factoryName, string managedVirtualNetworkName, string managedPrivateEndpointName, ManagedPrivateEndpointResource managedPrivateEndpoint, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, factoryName, managedVirtualNetworkName, managedPrivateEndpointName, managedPrivateEndpoint, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a managed private endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed private endpoint name + /// + /// + /// ETag of the managed private endpoint entity. Should only be specified for + /// get. If the ETag matches the existing entity tag, or if * was provided, + /// then no content will be returned. + /// + public static ManagedPrivateEndpointResource Get(this IManagedPrivateEndpointsOperations operations, string resourceGroupName, string factoryName, string managedVirtualNetworkName, string managedPrivateEndpointName, string ifNoneMatch = default(string)) + { + return operations.GetAsync(resourceGroupName, factoryName, managedVirtualNetworkName, managedPrivateEndpointName, ifNoneMatch).GetAwaiter().GetResult(); + } + + /// + /// Gets a managed private endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed private endpoint name + /// + /// + /// ETag of the managed private endpoint entity. Should only be specified for + /// get. If the ETag matches the existing entity tag, or if * was provided, + /// then no content will be returned. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedPrivateEndpointsOperations operations, string resourceGroupName, string factoryName, string managedVirtualNetworkName, string managedPrivateEndpointName, string ifNoneMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, factoryName, managedVirtualNetworkName, managedPrivateEndpointName, ifNoneMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a managed private endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed private endpoint name + /// + public static void Delete(this IManagedPrivateEndpointsOperations operations, string resourceGroupName, string factoryName, string managedVirtualNetworkName, string managedPrivateEndpointName) + { + operations.DeleteAsync(resourceGroupName, factoryName, managedVirtualNetworkName, managedPrivateEndpointName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a managed private endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed private endpoint name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IManagedPrivateEndpointsOperations operations, string resourceGroupName, string factoryName, string managedVirtualNetworkName, string managedPrivateEndpointName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, factoryName, managedVirtualNetworkName, managedPrivateEndpointName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists managed private endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByFactoryNext(this IManagedPrivateEndpointsOperations operations, string nextPageLink) + { + return operations.ListByFactoryNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists managed private endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByFactoryNextAsync(this IManagedPrivateEndpointsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByFactoryNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedVirtualNetworksOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedVirtualNetworksOperations.cs new file mode 100644 index 000000000000..fcfd56febbdd --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedVirtualNetworksOperations.cs @@ -0,0 +1,999 @@ +// +// 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.DataFactory +{ + 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; + + /// + /// ManagedVirtualNetworksOperations operations. + /// + internal partial class ManagedVirtualNetworksOperations : IServiceOperations, IManagedVirtualNetworksOperations + { + /// + /// Initializes a new instance of the ManagedVirtualNetworksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedVirtualNetworksOperations(DataFactoryManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataFactoryManagementClient + /// + public DataFactoryManagementClient Client { get; private set; } + + /// + /// Lists managed Virtual Networks. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// 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>> ListByFactoryWithHttpMessagesAsync(string resourceGroupName, string factoryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (factoryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "factoryName"); + } + if (factoryName != null) + { + if (factoryName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "factoryName", 63); + } + if (factoryName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "factoryName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(factoryName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "factoryName", "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"); + } + } + 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("resourceGroupName", resourceGroupName); + tracingParameters.Add("factoryName", factoryName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByFactory", 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.DataFactory/factories/{factoryName}/managedVirtualNetworks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{factoryName}", System.Uri.EscapeDataString(factoryName)); + 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 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(); + } + // 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 or updates a managed Virtual Network. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed Virtual Network resource definition. + /// + /// + /// ETag of the managed Virtual Network entity. Should only be specified for + /// update, for which it should match existing entity or can be * for + /// unconditional update. + /// + /// + /// 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(string resourceGroupName, string factoryName, string managedVirtualNetworkName, ManagedVirtualNetworkResource managedVirtualNetwork, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (factoryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "factoryName"); + } + if (factoryName != null) + { + if (factoryName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "factoryName", 63); + } + if (factoryName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "factoryName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(factoryName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "factoryName", "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"); + } + } + if (managedVirtualNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedVirtualNetworkName"); + } + if (managedVirtualNetworkName != null) + { + if (managedVirtualNetworkName.Length > 127) + { + throw new ValidationException(ValidationRules.MaxLength, "managedVirtualNetworkName", 127); + } + if (managedVirtualNetworkName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "managedVirtualNetworkName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(managedVirtualNetworkName, "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$")) + { + throw new ValidationException(ValidationRules.Pattern, "managedVirtualNetworkName", "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (managedVirtualNetwork == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedVirtualNetwork"); + } + if (managedVirtualNetwork != null) + { + managedVirtualNetwork.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("factoryName", factoryName); + tracingParameters.Add("managedVirtualNetworkName", managedVirtualNetworkName); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("managedVirtualNetwork", managedVirtualNetwork); + 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.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{factoryName}", System.Uri.EscapeDataString(factoryName)); + _url = _url.Replace("{managedVirtualNetworkName}", System.Uri.EscapeDataString(managedVirtualNetworkName)); + 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 (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + 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(managedVirtualNetwork != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(managedVirtualNetwork, 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) + { + 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(); + } + // 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; + } + + /// + /// Gets a managed Virtual Network. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// ETag of the managed Virtual Network entity. Should only be specified for + /// get. If the ETag matches the existing entity tag, or if * was provided, + /// then no content will be returned. + /// + /// + /// 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 factoryName, string managedVirtualNetworkName, string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (factoryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "factoryName"); + } + if (factoryName != null) + { + if (factoryName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "factoryName", 63); + } + if (factoryName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "factoryName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(factoryName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "factoryName", "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"); + } + } + if (managedVirtualNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedVirtualNetworkName"); + } + if (managedVirtualNetworkName != null) + { + if (managedVirtualNetworkName.Length > 127) + { + throw new ValidationException(ValidationRules.MaxLength, "managedVirtualNetworkName", 127); + } + if (managedVirtualNetworkName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "managedVirtualNetworkName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(managedVirtualNetworkName, "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$")) + { + throw new ValidationException(ValidationRules.Pattern, "managedVirtualNetworkName", "^([_A-Za-z0-9]|([_A-Za-z0-9][-_A-Za-z0-9]{0,125}[_A-Za-z0-9]))$"); + } + } + 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("resourceGroupName", resourceGroupName); + tracingParameters.Add("factoryName", factoryName); + tracingParameters.Add("managedVirtualNetworkName", managedVirtualNetworkName); + tracingParameters.Add("ifNoneMatch", ifNoneMatch); + 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.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{factoryName}", System.Uri.EscapeDataString(factoryName)); + _url = _url.Replace("{managedVirtualNetworkName}", System.Uri.EscapeDataString(managedVirtualNetworkName)); + 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 (ifNoneMatch != null) + { + if (_httpRequest.Headers.Contains("If-None-Match")) + { + _httpRequest.Headers.Remove("If-None-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-None-Match", ifNoneMatch); + } + 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(); + } + // 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 managed Virtual Networks. + /// + /// + /// 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>> ListByFactoryNextWithHttpMessagesAsync(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, "ListByFactoryNext", 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 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(); + } + // 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/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedVirtualNetworksOperationsExtensions.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedVirtualNetworksOperationsExtensions.cs new file mode 100644 index 000000000000..577dc8accda6 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/ManagedVirtualNetworksOperationsExtensions.cs @@ -0,0 +1,217 @@ +// +// 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.DataFactory +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedVirtualNetworksOperations. + /// + public static partial class ManagedVirtualNetworksOperationsExtensions + { + /// + /// Lists managed Virtual Networks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + public static IPage ListByFactory(this IManagedVirtualNetworksOperations operations, string resourceGroupName, string factoryName) + { + return operations.ListByFactoryAsync(resourceGroupName, factoryName).GetAwaiter().GetResult(); + } + + /// + /// Lists managed Virtual Networks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByFactoryAsync(this IManagedVirtualNetworksOperations operations, string resourceGroupName, string factoryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByFactoryWithHttpMessagesAsync(resourceGroupName, factoryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a managed Virtual Network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed Virtual Network resource definition. + /// + /// + /// ETag of the managed Virtual Network entity. Should only be specified for + /// update, for which it should match existing entity or can be * for + /// unconditional update. + /// + public static ManagedVirtualNetworkResource CreateOrUpdate(this IManagedVirtualNetworksOperations operations, string resourceGroupName, string factoryName, string managedVirtualNetworkName, ManagedVirtualNetworkResource managedVirtualNetwork, string ifMatch = default(string)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, factoryName, managedVirtualNetworkName, managedVirtualNetwork, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a managed Virtual Network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// Managed Virtual Network resource definition. + /// + /// + /// ETag of the managed Virtual Network entity. Should only be specified for + /// update, for which it should match existing entity or can be * for + /// unconditional update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagedVirtualNetworksOperations operations, string resourceGroupName, string factoryName, string managedVirtualNetworkName, ManagedVirtualNetworkResource managedVirtualNetwork, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, factoryName, managedVirtualNetworkName, managedVirtualNetwork, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a managed Virtual Network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// ETag of the managed Virtual Network entity. Should only be specified for + /// get. If the ETag matches the existing entity tag, or if * was provided, + /// then no content will be returned. + /// + public static ManagedVirtualNetworkResource Get(this IManagedVirtualNetworksOperations operations, string resourceGroupName, string factoryName, string managedVirtualNetworkName, string ifNoneMatch = default(string)) + { + return operations.GetAsync(resourceGroupName, factoryName, managedVirtualNetworkName, ifNoneMatch).GetAwaiter().GetResult(); + } + + /// + /// Gets a managed Virtual Network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// Managed virtual network name + /// + /// + /// ETag of the managed Virtual Network entity. Should only be specified for + /// get. If the ETag matches the existing entity tag, or if * was provided, + /// then no content will be returned. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedVirtualNetworksOperations operations, string resourceGroupName, string factoryName, string managedVirtualNetworkName, string ifNoneMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, factoryName, managedVirtualNetworkName, ifNoneMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists managed Virtual Networks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByFactoryNext(this IManagedVirtualNetworksOperations operations, string nextPageLink) + { + return operations.ListByFactoryNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists managed Virtual Networks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByFactoryNextAsync(this IManagedVirtualNetworksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByFactoryNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureFileStorageWriteSettings.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureFileStorageWriteSettings.cs new file mode 100644 index 000000000000..10849e9db258 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureFileStorageWriteSettings.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.DataFactory.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Azure File Storage write settings. + /// + public partial class AzureFileStorageWriteSettings : StoreWriteSettings + { + /// + /// Initializes a new instance of the AzureFileStorageWriteSettings + /// class. + /// + public AzureFileStorageWriteSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureFileStorageWriteSettings + /// class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// The maximum concurrent + /// connection count for the source data store. Type: integer (or + /// Expression with resultType integer). + /// The type of copy behavior for copy + /// sink. + public AzureFileStorageWriteSettings(IDictionary additionalProperties = default(IDictionary), object maxConcurrentConnections = default(object), object copyBehavior = default(object)) + : base(additionalProperties, maxConcurrentConnections, copyBehavior) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ConnectionStateProperties.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ConnectionStateProperties.cs new file mode 100644 index 000000000000..4d636f0110aa --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ConnectionStateProperties.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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The connection state of a managed private endpoint + /// + public partial class ConnectionStateProperties + { + /// + /// Initializes a new instance of the ConnectionStateProperties class. + /// + public ConnectionStateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConnectionStateProperties class. + /// + /// The actions required on the managed + /// private endpoint + /// The managed private endpoint + /// description + /// The approval status + public ConnectionStateProperties(string actionsRequired = default(string), string description = default(string), string status = default(string)) + { + ActionsRequired = actionsRequired; + Description = description; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the actions required on the managed private endpoint + /// + [JsonProperty(PropertyName = "actionsRequired")] + public string ActionsRequired { get; private set; } + + /// + /// Gets the managed private endpoint description + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + /// + /// Gets the approval status + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CosmosDbSqlApiSource.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CosmosDbSqlApiSource.cs index 19f4c02b6a24..39e3c972e981 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CosmosDbSqlApiSource.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CosmosDbSqlApiSource.cs @@ -47,15 +47,19 @@ public CosmosDbSqlApiSource() /// Expression with resultType integer). /// Preferred regions. Type: array of /// strings (or Expression with resultType array of strings). + /// Whether detect primitive values as + /// datetime values. Type: boolean (or Expression with resultType + /// boolean). /// Specifies the additional columns to /// be added to source data. Type: array of objects (or Expression with /// resultType array of objects). - public CosmosDbSqlApiSource(IDictionary additionalProperties = default(IDictionary), object sourceRetryCount = default(object), object sourceRetryWait = default(object), object maxConcurrentConnections = default(object), object query = default(object), object pageSize = default(object), object preferredRegions = default(object), IList additionalColumns = default(IList)) + public CosmosDbSqlApiSource(IDictionary additionalProperties = default(IDictionary), object sourceRetryCount = default(object), object sourceRetryWait = default(object), object maxConcurrentConnections = default(object), object query = default(object), object pageSize = default(object), object preferredRegions = default(object), object detectDatetime = default(object), IList additionalColumns = default(IList)) : base(additionalProperties, sourceRetryCount, sourceRetryWait, maxConcurrentConnections) { Query = query; PageSize = pageSize; PreferredRegions = preferredRegions; + DetectDatetime = detectDatetime; AdditionalColumns = additionalColumns; CustomInit(); } @@ -86,6 +90,13 @@ public CosmosDbSqlApiSource() [JsonProperty(PropertyName = "preferredRegions")] public object PreferredRegions { get; set; } + /// + /// Gets or sets whether detect primitive values as datetime values. + /// Type: boolean (or Expression with resultType boolean). + /// + [JsonProperty(PropertyName = "detectDatetime")] + public object DetectDatetime { get; set; } + /// /// Gets or sets specifies the additional columns to be added to source /// data. Type: array of objects (or Expression with resultType array diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ExposureControlBatchRequest.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ExposureControlBatchRequest.cs new file mode 100644 index 000000000000..4dd400968152 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ExposureControlBatchRequest.cs @@ -0,0 +1,70 @@ +// +// 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.DataFactory.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of exposure control features. + /// + public partial class ExposureControlBatchRequest + { + /// + /// Initializes a new instance of the ExposureControlBatchRequest + /// class. + /// + public ExposureControlBatchRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExposureControlBatchRequest + /// class. + /// + /// List of exposure control + /// features. + public ExposureControlBatchRequest(IList exposureControlRequests) + { + ExposureControlRequests = exposureControlRequests; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of exposure control features. + /// + [JsonProperty(PropertyName = "exposureControlRequests")] + public IList ExposureControlRequests { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ExposureControlRequests == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ExposureControlRequests"); + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ExposureControlBatchResponse.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ExposureControlBatchResponse.cs new file mode 100644 index 000000000000..d17463940903 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ExposureControlBatchResponse.cs @@ -0,0 +1,70 @@ +// +// 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.DataFactory.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of exposure control feature values. + /// + public partial class ExposureControlBatchResponse + { + /// + /// Initializes a new instance of the ExposureControlBatchResponse + /// class. + /// + public ExposureControlBatchResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExposureControlBatchResponse + /// class. + /// + /// List of exposure control + /// feature values. + public ExposureControlBatchResponse(IList exposureControlResponses) + { + ExposureControlResponses = exposureControlResponses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of exposure control feature values. + /// + [JsonProperty(PropertyName = "exposureControlResponses")] + public IList ExposureControlResponses { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ExposureControlResponses == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ExposureControlResponses"); + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/HdfsReadSettings.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/HdfsReadSettings.cs index 3b5916fe2b6b..f8e846b2d31b 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/HdfsReadSettings.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/HdfsReadSettings.cs @@ -60,7 +60,11 @@ public HdfsReadSettings() /// string). /// Specifies Distcp-related /// settings. - public HdfsReadSettings(IDictionary additionalProperties = default(IDictionary), object maxConcurrentConnections = default(object), object recursive = default(object), object wildcardFolderPath = default(object), object wildcardFileName = default(object), object fileListPath = default(object), bool? enablePartitionDiscovery = default(bool?), object partitionRootPath = default(object), object modifiedDatetimeStart = default(object), object modifiedDatetimeEnd = default(object), DistcpSettings distcpSettings = default(DistcpSettings)) + /// Indicates whether the + /// source files need to be deleted after copy completion. Default is + /// false. Type: boolean (or Expression with resultType + /// boolean). + public HdfsReadSettings(IDictionary additionalProperties = default(IDictionary), object maxConcurrentConnections = default(object), object recursive = default(object), object wildcardFolderPath = default(object), object wildcardFileName = default(object), object fileListPath = default(object), bool? enablePartitionDiscovery = default(bool?), object partitionRootPath = default(object), object modifiedDatetimeStart = default(object), object modifiedDatetimeEnd = default(object), DistcpSettings distcpSettings = default(DistcpSettings), object deleteFilesAfterCompletion = default(object)) : base(additionalProperties, maxConcurrentConnections) { Recursive = recursive; @@ -72,6 +76,7 @@ public HdfsReadSettings() ModifiedDatetimeStart = modifiedDatetimeStart; ModifiedDatetimeEnd = modifiedDatetimeEnd; DistcpSettings = distcpSettings; + DeleteFilesAfterCompletion = deleteFilesAfterCompletion; CustomInit(); } @@ -143,6 +148,14 @@ public HdfsReadSettings() [JsonProperty(PropertyName = "distcpSettings")] public DistcpSettings DistcpSettings { get; set; } + /// + /// Gets or sets indicates whether the source files need to be deleted + /// after copy completion. Default is false. Type: boolean (or + /// Expression with resultType boolean). + /// + [JsonProperty(PropertyName = "deleteFilesAfterCompletion")] + public object DeleteFilesAfterCompletion { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedPrivateEndpoint.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedPrivateEndpoint.cs new file mode 100644 index 000000000000..72a03af2f080 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedPrivateEndpoint.cs @@ -0,0 +1,110 @@ +// +// 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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a managed private endpoint + /// + public partial class ManagedPrivateEndpoint + { + /// + /// Initializes a new instance of the ManagedPrivateEndpoint class. + /// + public ManagedPrivateEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedPrivateEndpoint class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// The managed private endpoint + /// connection state + /// Fully qualified domain names + /// The groupId to which the managed private + /// endpoint is created + /// Denotes whether the managed private + /// endpoint is reserved + /// The ARM resource ID of the + /// resource to which the managed private endpoint is created + /// The managed private endpoint + /// provisioning state + public ManagedPrivateEndpoint(IDictionary additionalProperties = default(IDictionary), ConnectionStateProperties connectionState = default(ConnectionStateProperties), IList fqdns = default(IList), string groupId = default(string), bool? isReserved = default(bool?), string privateLinkResourceId = default(string), string provisioningState = default(string)) + { + AdditionalProperties = additionalProperties; + ConnectionState = connectionState; + Fqdns = fqdns; + GroupId = groupId; + IsReserved = isReserved; + PrivateLinkResourceId = privateLinkResourceId; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Gets or sets the managed private endpoint connection state + /// + [JsonProperty(PropertyName = "connectionState")] + public ConnectionStateProperties ConnectionState { get; set; } + + /// + /// Gets or sets fully qualified domain names + /// + [JsonProperty(PropertyName = "fqdns")] + public IList Fqdns { get; set; } + + /// + /// Gets or sets the groupId to which the managed private endpoint is + /// created + /// + [JsonProperty(PropertyName = "groupId")] + public string GroupId { get; set; } + + /// + /// Gets denotes whether the managed private endpoint is reserved + /// + [JsonProperty(PropertyName = "isReserved")] + public bool? IsReserved { get; private set; } + + /// + /// Gets or sets the ARM resource ID of the resource to which the + /// managed private endpoint is created + /// + [JsonProperty(PropertyName = "privateLinkResourceId")] + public string PrivateLinkResourceId { get; set; } + + /// + /// Gets the managed private endpoint provisioning state + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedPrivateEndpointResource.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedPrivateEndpointResource.cs new file mode 100644 index 000000000000..4b2023aa4b89 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedPrivateEndpointResource.cs @@ -0,0 +1,73 @@ +// +// 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.DataFactory.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Managed private endpoint resource type. + /// + public partial class ManagedPrivateEndpointResource : SubResource + { + /// + /// Initializes a new instance of the ManagedPrivateEndpointResource + /// class. + /// + public ManagedPrivateEndpointResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedPrivateEndpointResource + /// class. + /// + /// Managed private endpoint + /// properties. + /// The resource identifier. + /// The resource name. + /// The resource type. + /// Etag identifies change in the resource. + public ManagedPrivateEndpointResource(ManagedPrivateEndpoint properties, string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + : base(id, name, type, etag) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets managed private endpoint properties. + /// + [JsonProperty(PropertyName = "properties")] + public ManagedPrivateEndpoint Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedVirtualNetwork.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedVirtualNetwork.cs new file mode 100644 index 000000000000..43d8aa7af74f --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedVirtualNetwork.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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A managed Virtual Network associated with the Azure Data Factory + /// + public partial class ManagedVirtualNetwork + { + /// + /// Initializes a new instance of the ManagedVirtualNetwork class. + /// + public ManagedVirtualNetwork() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedVirtualNetwork class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// Managed Virtual Network ID. + /// Managed Virtual Network alias. + public ManagedVirtualNetwork(IDictionary additionalProperties = default(IDictionary), string vNetId = default(string), string alias = default(string)) + { + AdditionalProperties = additionalProperties; + VNetId = vNetId; + Alias = alias; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Gets managed Virtual Network ID. + /// + [JsonProperty(PropertyName = "vNetId")] + public string VNetId { get; private set; } + + /// + /// Gets managed Virtual Network alias. + /// + [JsonProperty(PropertyName = "alias")] + public string Alias { get; private set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedVirtualNetworkResource.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedVirtualNetworkResource.cs new file mode 100644 index 000000000000..20120707daaf --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ManagedVirtualNetworkResource.cs @@ -0,0 +1,73 @@ +// +// 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.DataFactory.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Managed Virtual Network resource type. + /// + public partial class ManagedVirtualNetworkResource : SubResource + { + /// + /// Initializes a new instance of the ManagedVirtualNetworkResource + /// class. + /// + public ManagedVirtualNetworkResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedVirtualNetworkResource + /// class. + /// + /// Managed Virtual Network + /// properties. + /// The resource identifier. + /// The resource name. + /// The resource type. + /// Etag identifies change in the resource. + public ManagedVirtualNetworkResource(ManagedVirtualNetwork properties, string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + : base(id, name, type, etag) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets managed Virtual Network properties. + /// + [JsonProperty(PropertyName = "properties")] + public ManagedVirtualNetwork Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/XmlReadSettings.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/XmlReadSettings.cs index 0638822125c0..7a24131901b3 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/XmlReadSettings.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/XmlReadSettings.cs @@ -37,17 +37,25 @@ public XmlReadSettings() /// Indicates what validation method is /// used when reading the xml files. Allowed values: 'none', 'xsd', or /// 'dtd'. Type: string (or Expression with resultType string). + /// Indicates whether type detection is + /// enabled when reading the xml files. Type: boolean (or Expression + /// with resultType boolean). + /// Indicates whether namespace is enabled + /// when reading the xml files. Type: boolean (or Expression with + /// resultType boolean). /// Namespace uri to prefix mappings to /// override the prefixes in column names when namespace is enabled, if /// no prefix is defined for a namespace uri, the prefix of xml /// element/attribute name in the xml data file will be used. Example: /// "{"http://www.example.com/xml":"prefix"}" Type: object (or /// Expression with resultType object). - public XmlReadSettings(IDictionary additionalProperties = default(IDictionary), CompressionReadSettings compressionProperties = default(CompressionReadSettings), object validationMode = default(object), object namespacePrefixes = default(object)) + public XmlReadSettings(IDictionary additionalProperties = default(IDictionary), CompressionReadSettings compressionProperties = default(CompressionReadSettings), object validationMode = default(object), object detectDataType = default(object), object namespaces = default(object), object namespacePrefixes = default(object)) : base(additionalProperties) { CompressionProperties = compressionProperties; ValidationMode = validationMode; + DetectDataType = detectDataType; + Namespaces = namespaces; NamespacePrefixes = namespacePrefixes; CustomInit(); } @@ -71,6 +79,22 @@ public XmlReadSettings() [JsonProperty(PropertyName = "validationMode")] public object ValidationMode { get; set; } + /// + /// Gets or sets indicates whether type detection is enabled when + /// reading the xml files. Type: boolean (or Expression with resultType + /// boolean). + /// + [JsonProperty(PropertyName = "detectDataType")] + public object DetectDataType { get; set; } + + /// + /// Gets or sets indicates whether namespace is enabled when reading + /// the xml files. Type: boolean (or Expression with resultType + /// boolean). + /// + [JsonProperty(PropertyName = "namespaces")] + public object Namespaces { get; set; } + /// /// Gets or sets namespace uri to prefix mappings to override the /// prefixes in column names when namespace is enabled, if no prefix is diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Microsoft.Azure.Management.DataFactory.csproj b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Microsoft.Azure.Management.DataFactory.csproj index 39c9bf30f468..64d4746ee4c9 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Microsoft.Azure.Management.DataFactory.csproj +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Microsoft.Azure.Management.DataFactory.csproj @@ -14,6 +14,11 @@ - Added column delimiter for SAP Table/open hub - Added azureCloudType for Aad Auth - Added snapshot to Azure File Storage linked service +- Support HDFS for delete activity and deleteFilesAfterCompletion feature in copy activity +- Added support for managed Virtual Network and managed private endpoint CRUD APIs +- Added Support for Query EC List API +- Added more options on XML and CosmosDbSqlApi copy source +- Fix bug: Added AzureFileStorageWriteSettings ]]> diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/ManagedPrivateEndpointJsonSamples.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/ManagedPrivateEndpointJsonSamples.cs new file mode 100644 index 000000000000..580d9b9e6e5b --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/ManagedPrivateEndpointJsonSamples.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. + +using DataFactory.Tests.Utils; + +namespace DataFactory.Tests.JsonSamples +{ + public class ManagedPrivateEndpointJsonSamples : JsonSampleCollection + { + [JsonSample] + public const string ManagedPrivateEndpointSample = @" + { + ""name"": ""pe1"", + ""properties"": { + ""privateLinkResourceId"": ""/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/sampleResourceGroup/providers/Microsoft.Storage/storageAccounts/sampleStorageAccount"", + ""groupId"": ""blob"" + } + }"; + + [JsonSample] + public const string ManagedPrivateEndpointFqdnsSample = @" + { + ""name"": ""pe2"", + ""properties"": { + ""privateLinkResourceId"": ""/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/sampleResourceGroup/providers/Microsoft.Storage/storageAccounts/sampleStorageAccount"", + ""groupId"": ""blob"", + ""fqdns"": [ + ""darosalestorageaccount.blob.core.windows.net"" + ] + } + }"; + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/ManagedVirtualNetworkJsonSamples.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/ManagedVirtualNetworkJsonSamples.cs new file mode 100644 index 000000000000..37e20d3dee56 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/ManagedVirtualNetworkJsonSamples.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. + +using DataFactory.Tests.Utils; + +namespace DataFactory.Tests.JsonSamples +{ + public class ManagedVirtualNetworkJsonSamples : JsonSampleCollection + { + [JsonSample] + public const string ManagedPrivateEndpointSample = @"{ }"; + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/PipelineJsonSamples.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/PipelineJsonSamples.cs index 3bcc24393c91..3bc362d48a4c 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/PipelineJsonSamples.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/PipelineJsonSamples.cs @@ -4685,7 +4685,8 @@ public class PipelineJsonSamples : JsonSampleCollection ""enablePartitionDiscovery"": true, ""wildcardFolderPath"": ""A*"", ""modifiedDatetimeStart"": ""2019-07-02T00:00:00.000Z"", - ""modifiedDatetimeEnd"": ""2019-07-03T00:00:00.000Z"" + ""modifiedDatetimeEnd"": ""2019-07-03T00:00:00.000Z"", + ""deleteFilesAfterCompletion"": true }, ""formatSettings"": { ""type"": ""DelimitedTextReadSettings"", diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_Create.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_Create.json new file mode 100644 index 000000000000..bd99e8486d75 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_Create.json @@ -0,0 +1,46 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-1234-12345678abc", + "resourceGroupName": "exampleResourceGroup", + "factoryName": "exampleFactoryName", + "managedVirtualNetworkName": "exampleManagedVirtualNetworkName", + "managedPrivateEndpointName": "exampleManagedPrivateEndpointName", + "ifMatch": null, + "managedPrivateEndpoint": { + "properties": { + "privateLinkResourceId": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.Storage/storageAccounts/exampleBlobStorage", + "groupId": "blob", + "fqdns": [] + } + }, + "api-version": "2018-06-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Sat, 16 Jun 2018 00:37:41 GMT", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-subscription-writes": "1197", + "x-ms-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6", + "x-ms-correlation-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6" + }, + "body": { + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/managedVirtualNetworks/exampleManagedVirtualNetworkName/managedPrivateEndpoints/exampleManagedPrivateEndpointName", + "name": "exampleManagedPrivateEndpointName", + "type": "Microsoft.DataFactory/factories/managedVirtualNetworks/managedPrivateEndpoints", + "properties": { + "provisioningState": "Succeeded", + "privateLinkResourceId": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.Storage/storageAccounts/exampleBlobStorage", + "groupId": "blob", + "fqdns": [], + "connectionState": { + "status": "Pending", + "description": "", + "actionsRequired": "None" + } + }, + "etag": "000046c4-0000-0000-0000-5b2198bf0000" + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_Delete.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_Delete.json new file mode 100644 index 000000000000..8044f9fd4c0c --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_Delete.json @@ -0,0 +1,14 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-1234-12345678abc", + "resourceGroupName": "exampleResourceGroup", + "factoryName": "exampleFactoryName", + "managedVirtualNetworkName": "exampleManagedVirtualNetworkName", + "managedPrivateEndpointName": "exampleManagedPrivateEndpointName", + "api-version": "2018-06-01" + }, + "responses": { + "200": {}, + "204": {} + } +} \ No newline at end of file diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_Get.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_Get.json new file mode 100644 index 000000000000..3092bd2bd391 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_Get.json @@ -0,0 +1,39 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-1234-12345678abc", + "resourceGroupName": "exampleResourceGroup", + "factoryName": "exampleFactoryName", + "managedVirtualNetworkName": "exampleManagedVirtualNetworkName", + "managedPrivateEndpointName": "exampleManagedPrivateEndpointName", + "ifNoneMatch": "15003c4f-0000-0200-0000-5cbe090b0000", + "api-version": "2018-06-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Sat, 16 Jun 2018 00:37:41 GMT", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-subscription-reads": "11997", + "x-ms-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6", + "x-ms-correlation-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6" + }, + "body": { + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/managedVirtualNetworks/exampleManagedVirtualNetworkName/managedPrivateEndpoints/exampleManagedPrivateEndpointName", + "name": "exampleManagedPrivateEndpointName", + "type": "Microsoft.DataFactory/factories/managedVirtualNetworks/managedPrivateEndpoints", + "properties": { + "provisioningState": "Succeeded", + "privateLinkResourceId": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.Storage/storageAccounts/exampleBlobStorage", + "groupId": "blob", + "fqdns": [], + "connectionState": { + "status": "Pending", + "description": "", + "actionsRequired": "None" + } + }, + "etag": "000046c4-0000-0000-0000-5b2198bf0000" + } + } + } +} \ No newline at end of file diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_ListByFactory.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_ListByFactory.json new file mode 100644 index 000000000000..646db3f219de --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedPrivateEndpoints_ListByFactory.json @@ -0,0 +1,42 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-1234-12345678abc", + "resourceGroupName": "exampleResourceGroup", + "factoryName": "exampleFactoryName", + "managedVirtualNetworkName": "exampleManagedVirtualNetworkName", + "ifNoneMatch": null, + "api-version": "2018-06-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Sat, 16 Jun 2018 00:37:41 GMT", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-subscription-reads": "14909", + "x-ms-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6", + "x-ms-correlation-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6" + }, + "body": { + "value": [ + { + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/managedVirtualNetworks/exampleManagedVirtualNetworkName/managedPrivateEndpoints/exampleManagedPrivateEndpointName", + "name": "exampleManagedPrivateEndpointName", + "type": "Microsoft.DataFactory/factories/managedVirtualNetworks/managedPrivateEndpoints", + "properties": { + "provisioningState": "Succeeded", + "privateLinkResourceId": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.Storage/storageAccounts/exampleBlobStorage", + "groupId": "blob", + "fqdns": [], + "connectionState": { + "status": "Pending", + "description": "", + "actionsRequired": "None" + } + }, + "etag": "000046c4-0000-0000-0000-5b2198bf0000" + } + ] + } + } + } +} \ No newline at end of file diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedVirtualNetworks_Create.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedVirtualNetworks_Create.json new file mode 100644 index 000000000000..d9b8e0ca1d32 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedVirtualNetworks_Create.json @@ -0,0 +1,34 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-1234-12345678abc", + "resourceGroupName": "exampleResourceGroup", + "factoryName": "exampleFactoryName", + "managedVirtualNetworkName": "exampleManagedVirtualNetworkName", + "ifMatch": null, + "managedVirtualNetwork": { + "properties": {} + }, + "api-version": "2018-06-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Sat, 16 Jun 2018 00:37:41 GMT", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-subscription-writes": "1197", + "x-ms-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6", + "x-ms-correlation-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6" + }, + "body": { + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/managedVirtualNetworks/exampleManagedVirtualNetworkName", + "name": "exampleManagedVirtualNetworkName", + "type": "Microsoft.DataFactory/factories/managedVirtualNetworks", + "properties": { + "alias": "exampleFactoryName", + "vNetId": "12345678-1234-1234-1234-12345678123" + }, + "etag": "000046c4-0000-0000-0000-5b2198bf0000" + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedVirtualNetworks_Get.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedVirtualNetworks_Get.json new file mode 100644 index 000000000000..0b29c415ca30 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedVirtualNetworks_Get.json @@ -0,0 +1,31 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-1234-12345678abc", + "resourceGroupName": "exampleResourceGroup", + "factoryName": "exampleFactoryName", + "managedVirtualNetworkName": "exampleManagedVirtualNetworkName", + "ifNoneMatch": "15003c4f-0000-0200-0000-5cbe090b0000", + "api-version": "2018-06-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Sat, 16 Jun 2018 00:37:41 GMT", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-subscription-reads": "11997", + "x-ms-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6", + "x-ms-correlation-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6" + }, + "body": { + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/managedVirtualNetworks/exampleManagedVirtualNetworkName", + "name": "exampleManagedVirtualNetworkName", + "type": "Microsoft.DataFactory/factories/managedVirtualNetworks", + "properties": { + "alias": "exampleFactoryName", + "vNetId": "5a7bd944-87e6-454a-8d4d-9fba446514fd" + }, + "etag": "15003c4f-0000-0200-0000-5cbe090b0000" + } + } + } +} \ No newline at end of file diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedVirtualNetworks_ListByFactory.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedVirtualNetworks_ListByFactory.json new file mode 100644 index 000000000000..29cce3316bf4 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/ManagedVirtualNetworks_ListByFactory.json @@ -0,0 +1,34 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-1234-12345678abc", + "resourceGroupName": "exampleResourceGroup", + "factoryName": "exampleFactoryName", + "ifNoneMatch": null, + "api-version": "2018-06-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Sat, 16 Jun 2018 00:37:41 GMT", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-subscription-reads": "14909", + "x-ms-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6", + "x-ms-correlation-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6" + }, + "body": { + "value": [ + { + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/managedVirtualNetworks/exampleManagedVirtualNetworkName", + "name": "exampleManagedVirtualNetworkName", + "type": "Microsoft.DataFactory/factories/managedVirtualNetworks", + "properties": { + "alias": "exampleFactoryName", + "vNetId": "5a7bd944-87e6-454a-8d4d-9fba446514fd" + }, + "etag": "0400f1a1-0000-0000-0000-5b2188640000" + } + ] + } + } + } +} \ No newline at end of file diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ExamplesUnitTest.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ExamplesUnitTest.cs index 3576778f7f11..03430f6d9572 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ExamplesUnitTest.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ExamplesUnitTest.cs @@ -668,6 +668,75 @@ public void Operations_List() }); } + [Fact] + public void ManagedVirtualNetwork_Create() + { + RunTest("ManagedVirtualNetworks_Create", (example, client, responseCode) => + { + ManagedVirtualNetworkResource resource = client.ManagedVirtualNetworks.CreateOrUpdate(RGN(example), FN(example), MVN(example), MVR(example, client)); + CheckResponseBody(example, client, responseCode, resource); + }); + } + + [Fact] + public void ManagedVirtualNetwork_ListByFactory() + { + RunTest("ManagedVirtualNetworks_ListByFactory", (example, client, responseCode) => + { + IPage resources = client.ManagedVirtualNetworks.ListByFactory(RGN(example), FN(example)); + CheckResponseBody(example, client, responseCode, (Page)resources); + }); + } + + [Fact] + public void ManagedVirtualNetwork_Get() + { + RunTest("ManagedVirtualNetworks_Get", (example, client, responseCode) => + { + ManagedVirtualNetworkResource resource = client.ManagedVirtualNetworks.Get(RGN(example), FN(example), MVN(example)); + CheckResponseBody(example, client, responseCode, resource); + }); + } + + [Fact] + public void ManagedPrivateEndpoint_Create() + { + RunTest("ManagedPrivateEndpoints_Create", (example, client, responseCode) => + { + ManagedPrivateEndpointResource resource = client.ManagedPrivateEndpoints.CreateOrUpdate(RGN(example), FN(example), MVN(example), MPEN(example), MPER(example, client)); + CheckResponseBody(example, client, responseCode, resource); + }); + } + + [Fact] + public void ManagedPrivateEndpoint_ListByFactory() + { + RunTest("ManagedPrivateEndpoints_ListByFactory", (example, client, responseCode) => + { + IPage resources = client.ManagedPrivateEndpoints.ListByFactory(RGN(example), FN(example), MVN(example)); + CheckResponseBody(example, client, responseCode, (Page)resources); + }); + } + + [Fact] + public void ManagedPrivateEndpoint_Get() + { + RunTest("ManagedPrivateEndpoints_Get", (example, client, responseCode) => + { + ManagedPrivateEndpointResource resource = client.ManagedPrivateEndpoints.Get(RGN(example), FN(example), MVN(example), MPEN(example)); + CheckResponseBody(example, client, responseCode, resource); + }); + } + + [Fact] + public void ManagedPrivateEndpoint_Delete() + { + RunTest("ManagedPrivateEndpoints_Delete", (example, client, responseCode) => + { + client.ManagedPrivateEndpoints.Delete(RGN(example), FN(example), MVN(example), MPEN(example)); + }); + } + private List GetResponses(Example example) { List messages = new List(); @@ -808,6 +877,14 @@ private string LN(Example example) { return (string)example.Parameters["locationId"]; } + private string MPEN(Example example) + { + return (string)example.Parameters["managedPrivateEndpointName"]; + } + private string MVN(Example example) + { + return (string)example.Parameters["managedVirtualNetworkName"]; + } private T GetTypedObject(IDataFactoryManagementClient client, object objectRaw) { @@ -861,5 +938,15 @@ private DataFlowResource DFR(Example example, IDataFactoryManagementClient clien { return GetTypedParameter(example, client, "dataFlow"); } + + private ManagedPrivateEndpointResource MPER(Example example, IDataFactoryManagementClient client) + { + return GetTypedParameter(example, client, "managedPrivateEndpoint"); + } + + private ManagedVirtualNetworkResource MVR(Example example, IDataFactoryManagementClient client) + { + return GetTypedParameter(example, client, "managedVirtualNetwork"); + } } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ManagedPrivateEndpointTests.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ManagedPrivateEndpointTests.cs new file mode 100644 index 000000000000..5c0a2a5a651f --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ManagedPrivateEndpointTests.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. + +using DataFactory.Tests.JsonSamples; +using DataFactory.Tests.Utils; +using Microsoft.Azure.Management.DataFactory.Models; +using Microsoft.Rest.Serialization; +using Xunit; +using Xunit.Abstractions; +using Xunit.Sdk; + +namespace DataFactory.Tests.UnitTests +{ + public class ManagedPrivateEndpointTests : BaseUnitTest + { + // Enable Xunit test output logger. + protected readonly ITestOutputHelper logger = new TestOutputHelper(); + + public ManagedPrivateEndpointTests(ITestOutputHelper logger) + : base() + { + this.logger = logger; + } + + [Theory] + [ClassData(typeof(ManagedPrivateEndpointJsonSamples))] + [Trait(TraitName.TestType, TestType.Unit)] + public void ManagedPrivateEndpoint_SerializationTest(JsonSampleInfo jsonSample) + { + TestJsonSample(jsonSample); + } + + [Fact] + public void ManagedPrivateEndpoint_BlobTest() + { + string groupId = "blob"; + ManagedPrivateEndpointResource managedPrivateEndpointResource = new ManagedPrivateEndpointResource + { + Properties = new ManagedPrivateEndpoint + { + GroupId = groupId, + PrivateLinkResourceId = "/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/sampleResourceGroup/providers/Microsoft.Storage/storageAccounts/sampleStorageAccount" + } + }; + + var handler = new RecordedDelegatingHandler(); + var client = this.CreateWorkflowClient(handler); + var json = SafeJsonConvert.SerializeObject(managedPrivateEndpointResource, client.SerializationSettings); + Assert.Contains(groupId, json); + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ManagedVirtualNetworkTests.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ManagedVirtualNetworkTests.cs new file mode 100644 index 000000000000..3548b6cf2b58 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ManagedVirtualNetworkTests.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. + +using DataFactory.Tests.JsonSamples; +using DataFactory.Tests.Utils; +using Microsoft.Azure.Management.DataFactory.Models; +using Xunit; +using Xunit.Abstractions; +using Xunit.Sdk; + +namespace DataFactory.Tests.UnitTests +{ + public class ManagedVirtualNetworkTests : BaseUnitTest + { + // Enable Xunit test output logger. + protected readonly ITestOutputHelper logger = new TestOutputHelper(); + + public ManagedVirtualNetworkTests(ITestOutputHelper logger) + : base() + { + this.logger = logger; + } + + [Theory] + [ClassData(typeof(ManagedVirtualNetworkJsonSamples))] + [Trait(TraitName.TestType, TestType.Unit)] + public void ManagedVirtualNetwork_SerializationTest(JsonSampleInfo jsonSample) + { + TestJsonSample(jsonSample); + } + } +}