From 1d35a53786a52731915ef65e11da55944ee08fd8 Mon Sep 17 00:00:00 2001 From: Wanli Mao Date: Mon, 21 Jun 2021 13:43:53 +0800 Subject: [PATCH 1/2] add test --- .../IIntegrationRuntimesOperations.cs | 29 ++ .../IntegrationRuntimesOperations.cs | 251 ++++++++++++++++++ ...IntegrationRuntimesOperationsExtensions.cs | 48 ++++ ...oundNetworkDependenciesCategoryEndpoint.cs | 66 +++++ ...timeOutboundNetworkDependenciesEndpoint.cs | 63 +++++ ...boundNetworkDependenciesEndpointDetails.cs | 53 ++++ ...undNetworkDependenciesEndpointsResponse.cs | 57 ++++ .../IntegrationRuntimeVNetProperties.cs | 12 +- .../IntegrationRuntimeJsonSamples.cs | 35 +++ .../IntegrationRuntimeScenarioTests.cs | 6 +- .../UnitTests/IntegrationRuntimeTests.cs | 33 +++ 11 files changed, 651 insertions(+), 2 deletions(-) create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpoint.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/IntegrationRuntimeJsonSamples.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/IntegrationRuntimeTests.cs diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IIntegrationRuntimesOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IIntegrationRuntimesOperations.cs index 83f48ae643bd..a7bb558f1650 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IIntegrationRuntimesOperations.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IIntegrationRuntimesOperations.cs @@ -202,6 +202,35 @@ public partial interface IIntegrationRuntimesOperations /// Task> GetStatusWithHttpMessagesAsync(string resourceGroupName, string factoryName, string integrationRuntimeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets list of outbound dependency network for the given Azure-SSIS + /// integration runtime. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The integration runtime 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> OutboundNetworkDependenciesEndpointsWithHttpMessagesAsync(string resourceGroupName, string factoryName, string integrationRuntimeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets the on-premises integration runtime connection information for /// encrypting the on-premises data source credentials. /// diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IntegrationRuntimesOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IntegrationRuntimesOperations.cs index f43f5420807b..b12d0a42ad7b 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IntegrationRuntimesOperations.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IntegrationRuntimesOperations.cs @@ -1565,6 +1565,257 @@ internal IntegrationRuntimesOperations(DataFactoryManagementClient client) return _result; } + /// + /// Gets list of outbound dependency network for the given Azure-SSIS + /// integration runtime. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The integration runtime 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> OutboundNetworkDependenciesEndpointsWithHttpMessagesAsync(string resourceGroupName, string factoryName, string integrationRuntimeName, 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 (integrationRuntimeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "integrationRuntimeName"); + } + if (integrationRuntimeName != null) + { + if (integrationRuntimeName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "integrationRuntimeName", 63); + } + if (integrationRuntimeName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "integrationRuntimeName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(integrationRuntimeName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "integrationRuntimeName", "^[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("integrationRuntimeName", integrationRuntimeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "OutboundNetworkDependenciesEndpoints", 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}/integrationRuntimes/{integrationRuntimeName}/outboundNetworkDependenciesEndpoints").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("{integrationRuntimeName}", System.Uri.EscapeDataString(integrationRuntimeName)); + 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; + } + /// /// Gets the on-premises integration runtime connection information for /// encrypting the on-premises data source credentials. diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IntegrationRuntimesOperationsExtensions.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IntegrationRuntimesOperationsExtensions.cs index d202bc13d4ac..7d68488cf48a 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IntegrationRuntimesOperationsExtensions.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IntegrationRuntimesOperationsExtensions.cs @@ -320,6 +320,54 @@ public static IntegrationRuntimeStatusResponse GetStatus(this IIntegrationRuntim } } + /// + /// Gets list of outbound dependency network for the given Azure-SSIS + /// integration runtime. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The integration runtime name. + /// + public static IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse OutboundNetworkDependenciesEndpoints(this IIntegrationRuntimesOperations operations, string resourceGroupName, string factoryName, string integrationRuntimeName) + { + return operations.OutboundNetworkDependenciesEndpointsAsync(resourceGroupName, factoryName, integrationRuntimeName).GetAwaiter().GetResult(); + } + + /// + /// Gets list of outbound dependency network for the given Azure-SSIS + /// integration runtime. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The integration runtime name. + /// + /// + /// The cancellation token. + /// + public static async Task OutboundNetworkDependenciesEndpointsAsync(this IIntegrationRuntimesOperations operations, string resourceGroupName, string factoryName, string integrationRuntimeName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.OutboundNetworkDependenciesEndpointsWithHttpMessagesAsync(resourceGroupName, factoryName, integrationRuntimeName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets the on-premises integration runtime connection information for /// encrypting the on-premises data source credentials. diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.cs new file mode 100644 index 000000000000..383e45907ea9 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Integration runtime outbound network dependency endpoints of one + /// category. + /// + public partial class IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint + { + /// + /// Initializes a new instance of the + /// IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint + /// class. + /// + public IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint + /// class. + /// + /// Endpoint category. + /// Endpoints of one category. + public IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(string category = default(string), IList endpoints = default(IList)) + { + Category = category; + Endpoints = endpoints; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets endpoint category. + /// + [JsonProperty(PropertyName = "category")] + public string Category { get; set; } + + /// + /// Gets or sets endpoints of one category. + /// + [JsonProperty(PropertyName = "endpoints")] + public IList Endpoints { get; set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpoint.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpoint.cs new file mode 100644 index 000000000000..4554ff4f2eac --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpoint.cs @@ -0,0 +1,63 @@ +// +// 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; + + /// + /// Integration runtime outbound network dependency endpoint. + /// + public partial class IntegrationRuntimeOutboundNetworkDependenciesEndpoint + { + /// + /// Initializes a new instance of the + /// IntegrationRuntimeOutboundNetworkDependenciesEndpoint class. + /// + public IntegrationRuntimeOutboundNetworkDependenciesEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// IntegrationRuntimeOutboundNetworkDependenciesEndpoint class. + /// + /// Domain name. + /// Details of the endpoint. + public IntegrationRuntimeOutboundNetworkDependenciesEndpoint(string domainName = default(string), IList endpointDetails = default(IList)) + { + DomainName = domainName; + EndpointDetails = endpointDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets domain name. + /// + [JsonProperty(PropertyName = "domainName")] + public string DomainName { get; set; } + + /// + /// Gets or sets details of the endpoint. + /// + [JsonProperty(PropertyName = "endpointDetails")] + public IList EndpointDetails { get; set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.cs new file mode 100644 index 000000000000..6ac44dbe6e37 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Integration runtime outbound network dependency endpoint details. + /// + public partial class IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails + { + /// + /// Initializes a new instance of the + /// IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails class. + /// + public IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails class. + /// + /// port of the endpoint. + public IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(int? port = default(int?)) + { + Port = port; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets port of the endpoint. + /// + [JsonProperty(PropertyName = "port")] + public int? Port { get; set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse.cs new file mode 100644 index 000000000000..06a424b2a2e2 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse.cs @@ -0,0 +1,57 @@ +// +// 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; + + /// + /// Integration runtime outbound network dependencies endpoints. + /// + public partial class IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse + { + /// + /// Initializes a new instance of the + /// IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse + /// class. + /// + public IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse + /// class. + /// + /// List of endpoints. + public IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of endpoints. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeVNetProperties.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeVNetProperties.cs index d65652a7832f..06ab7544ca2a 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeVNetProperties.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeVNetProperties.cs @@ -41,12 +41,15 @@ public IntegrationRuntimeVNetProperties() /// runtime will join. /// Resource IDs of the public IP addresses /// that this integration runtime will use. - public IntegrationRuntimeVNetProperties(IDictionary additionalProperties = default(IDictionary), string vNetId = default(string), string subnet = default(string), IList publicIPs = default(IList)) + /// The ID of the Subnet that this integration + /// runtime will join. + public IntegrationRuntimeVNetProperties(IDictionary additionalProperties = default(IDictionary), string vNetId = default(string), string subnet = default(string), IList publicIPs = default(IList), string subnetId = default(string)) { AdditionalProperties = additionalProperties; VNetId = vNetId; Subnet = subnet; PublicIPs = publicIPs; + SubnetId = subnetId; CustomInit(); } @@ -83,5 +86,12 @@ public IntegrationRuntimeVNetProperties() [JsonProperty(PropertyName = "publicIPs")] public IList PublicIPs { get; set; } + /// + /// Gets or sets the ID of the Subnet that this integration runtime + /// will join. + /// + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } + } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/IntegrationRuntimeJsonSamples.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/IntegrationRuntimeJsonSamples.cs new file mode 100644 index 000000000000..78bad2427293 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/JsonSamples/IntegrationRuntimeJsonSamples.cs @@ -0,0 +1,35 @@ +// 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 IntegrationRuntimeJsonSamples: JsonSampleCollection + { + [JsonSample] + public const string AzureSSISIntegrationRuntime = @" +{ + ""properties"": { + ""type"": ""Managed"", + ""typeProperties"": { + ""computeProperties"": { + ""location"": ""West Us"", + ""nodeSize"": ""standard_d2_v3"", + ""numberOfNodes"": 1, + ""maxParallelExecutionsPerNode"": 4, + ""vNetProperties"": { + ""subnetId"": ""/subscriptions/1491d049-b7ce-4dc5-9833-d2947b0bd2e1/Azure_SSIS_API/providers/Microsoft.Network/virtualNetworks/FirstVNetForAzureSSIS/subnets/default"" + } + }, + ""ssisProperties"": { + ""licenseType"": ""BasePrice"", + ""edition"": ""Standard"" + } + } + }, + ""name"": ""rpV2testIntegrationRuntime-1cec239b-0b0a-460f-9e7a-0dfff4b885e6"" +}"; + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/ScenarioTests/IntegrationRuntimeScenarioTests.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/ScenarioTests/IntegrationRuntimeScenarioTests.cs index 7645ec0297ff..8e565c826ef1 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/ScenarioTests/IntegrationRuntimeScenarioTests.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/ScenarioTests/IntegrationRuntimeScenarioTests.cs @@ -155,7 +155,11 @@ public async Task SsisAzureIntegrationRuntimeScenarioTest() NodeSize = "Standard_D1_v2", MaxParallelExecutionsPerNode = 1, NumberOfNodes = 1, - Location = "WestUS" + Location = "WestUS", + VNetProperties = new IntegrationRuntimeVNetProperties + { + SubnetId = "/subscriptions/1491d049-b7ce-4dc5-9833-d2947b0bd2e1/resourceGroups/Azure_SSIS_API/providers/Microsoft.Network/virtualNetworks/FirstVNetForAzureSSIS/subnets/TestVnetJoin" + } }, SsisProperties = new IntegrationRuntimeSsisProperties { diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/IntegrationRuntimeTests.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/IntegrationRuntimeTests.cs new file mode 100644 index 000000000000..24bb2b32a685 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/IntegrationRuntimeTests.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 IntegrationRuntimeTests: BaseUnitTest + { + // Enable Xunit test output logger. + protected readonly ITestOutputHelper logger = new TestOutputHelper(); + + public IntegrationRuntimeTests(ITestOutputHelper logger) + : base() + { + this.logger = logger; + } + + [Theory] + [ClassData(typeof(IntegrationRuntimeJsonSamples))] + [Trait(TraitName.TestType, TestType.Unit)] + public void IntegrationRuntime_SerializationTest(JsonSampleInfo jsonSample) + { + TestJsonSample(jsonSample); + } + } +} From d38ec627ab59f485995e3dd97fc1fbcba6115182 Mon Sep 17 00:00:00 2001 From: Wanli Mao Date: Mon, 21 Jun 2021 18:40:49 +0800 Subject: [PATCH 2/2] add test --- .../IntegrationRuntimeScenarioTests.cs | 5 ++ ...isAzureIntegrationRuntimeScenarioTest.json | 67 +++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/ScenarioTests/IntegrationRuntimeScenarioTests.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/ScenarioTests/IntegrationRuntimeScenarioTests.cs index 8e565c826ef1..1bf1904bfa32 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/ScenarioTests/IntegrationRuntimeScenarioTests.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/ScenarioTests/IntegrationRuntimeScenarioTests.cs @@ -224,6 +224,11 @@ await client.IntegrationRuntimes.StopAsync( integrationRuntimeName); managedStatus = status.Properties as ManagedIntegrationRuntimeStatus; Assert.Equal(IntegrationRuntimeState.Stopped, managedStatus.State); + + await client.IntegrationRuntimes.OutboundNetworkDependenciesEndpointsAsync( + this.ResourceGroupName, + this.DataFactoryName, + integrationRuntimeName); }; Func finallyAction = async (client) => diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/SessionRecords/IntegrationRuntimeScenarioTests/SsisAzureIntegrationRuntimeScenarioTest.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/SessionRecords/IntegrationRuntimeScenarioTests/SsisAzureIntegrationRuntimeScenarioTest.json index 3af81b862f69..dc857c661cbe 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/SessionRecords/IntegrationRuntimeScenarioTests/SsisAzureIntegrationRuntimeScenarioTest.json +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/SessionRecords/IntegrationRuntimeScenarioTests/SsisAzureIntegrationRuntimeScenarioTest.json @@ -6179,6 +6179,73 @@ }, "StatusCode": 200 }, + { + "RequestUri": "/subscriptions/c39dce18-cead-4065-8fb1-3af7683a5038/resourceGroups/sdktestingadfrg5566/providers/Microsoft.DataFactory/factories/sdktestingfactory352/integrationRuntimes/ssisazureintegrationruntime/outboundNetworkDependenciesEndpoints?api-version=2018-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYzM5ZGNlMTgtY2VhZC00MDY1LThmYjEtM2FmNzY4M2E1MDM4L3Jlc291cmNlR3JvdXBzL3Nka3Rlc3RpbmdhZGZyZzU1NjYvcHJvdmlkZXJzL01pY3Jvc29mdC5EYXRhRmFjdG9yeS9mYWN0b3JpZXMvc2RrdGVzdGluZ2ZhY3RvcnkzNTIvaW50ZWdyYXRpb25SdW50aW1lcy9zc2lzYXp1cmVpbnRlZ3JhdGlvbnJ1bnRpbWUvb3V0Ym91bmROZXR3b3JrRGVwZW5kZW5jaWVzRW5kcG9pbnRzP2FwaS12ZXJzaW9uPTIwMTgtMDYtMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "a8010bda-5d3a-4a64-8862-cbb79c787d6d" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.DataFactory.DataFactoryManagementClient/0.8.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"category\": \"Azure Data Factory (Management)\",\r\n \"endpoints\": [\r\n {\r\n \"domainName\": \"wu.frontend.clouddatahub.net\",\r\n \"endpointDetails\": [\r\n {\r\n \"port\": 443\r\n }\r\n ]\r\n }\r\n ]\r\n },\r\n {\r\n \"category\": \"Azure Storage (Management)\",\r\n \"endpoints\": [\r\n {\r\n \"domainName\": \"*.blob.core.windows.net\",\r\n \"endpointDetails\": [\r\n {\r\n \"port\": 443\r\n }\r\n ]\r\n },\r\n {\r\n \"domainName\": \"*.table.core.windows.net\",\r\n \"endpointDetails\": [\r\n {\r\n \"port\": 443\r\n }\r\n ]\r\n }\r\n ]\r\n },\r\n {\r\n \"category\": \"Event Hub (Logging)\",\r\n \"endpoints\": [\r\n {\r\n \"domainName\": \"*.servicebus.windows.net\",\r\n \"endpointDetails\": [\r\n {\r\n \"port\": 443\r\n }\r\n ]\r\n }\r\n ]\r\n },\r\n {\r\n \"category\": \"Microsoft Logging service (Internal Use)\",\r\n \"endpoints\": [\r\n {\r\n \"domainName\": \"gcs.prod.monitoring.core.windows.net\",\r\n \"endpointDetails\": [\r\n {\r\n \"port\": 443\r\n }\r\n ]\r\n },\r\n {\r\n \"domainName\": \"prod.warmpath.msftcloudes.com\",\r\n \"endpointDetails\": [\r\n {\r\n \"port\": 443\r\n }\r\n ]\r\n },\r\n {\r\n \"domainName\": \"azurewatsonanalysis-prod.core.windows.net\",\r\n \"endpointDetails\": [\r\n {\r\n \"port\": 443\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 22 Jun 2018 09:11:59 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-IIS/8.5" + ], + "Vary": [ + "Accept-Encoding" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14911" + ], + "x-ms-request-id": [ + "13326532-db8c-4e0e-abfc-9e86764b3c60" + ], + "x-ms-correlation-request-id": [ + "13326532-db8c-4e0e-abfc-9e86764b3c60" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20180622T091200Z:13326532-db8c-4e0e-abfc-9e86764b3c60" + ] + }, + "StatusCode": 200 + }, { "RequestUri": "/subscriptions/c39dce18-cead-4065-8fb1-3af7683a5038/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1TREtURVNUSU5HQURGUkc1NTY2LVdFU1RFVVJPUEUiLCJqb2JMb2NhdGlvbiI6Indlc3RldXJvcGUifQ?api-version=2017-05-10", "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYzM5ZGNlMTgtY2VhZC00MDY1LThmYjEtM2FmNzY4M2E1MDM4L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFUUkV0VVJWTlVTVTVIUVVSR1VrYzFOVFkyTFZkRlUxUkZWVkpQVUVVaUxDSnFiMkpNYjJOaGRHbHZiaUk2SW5kbGMzUmxkWEp2Y0dVaWZRP2FwaS12ZXJzaW9uPTIwMTctMDUtMTA=",