Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -449,5 +449,115 @@ public void FirewallAndTrustedProviderCRUDTest()
}
}
}

[Fact]
public void VirtualNetworkRulesCRUDTest()
{
using (var context = MockContext.Start(this.GetType().FullName))
{
commonData = new CommonTestFixture(context);
var clientToUse = this.GetDataLakeStoreAccountManagementClient(context);

// Create an account with virtual network rules.
var adlsAccountName = TestUtilities.GenerateName("adlsacct");
var vNetRuleName1 = TestUtilities.GenerateName("vnetrule1");
var subnetId = "/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.Network/virtualNetworks/lewuVNET/subnets/default";

var responseCreate =
clientToUse.Accounts.Create(
resourceGroupName: commonData.ResourceGroupName,
accountName: adlsAccountName,
parameters: new CreateDataLakeStoreAccountParameters
{
Location = commonData.Location,
VirtualNetworkRules = new List<CreateVirtualNetworkRuleWithAccountParameters>
{
new CreateVirtualNetworkRuleWithAccountParameters
{
Name = vNetRuleName1,
SubnetId = subnetId
}
},
FirewallState = FirewallState.Enabled,
FirewallAllowAzureIps = FirewallAllowAzureIpsState.Enabled
}
);

Assert.Equal(DataLakeStoreAccountStatus.Succeeded, responseCreate.ProvisioningState);

// Get the account and ensure that all the values are properly set.
var responseGet =
clientToUse.Accounts.Get(
commonData.ResourceGroupName,
adlsAccountName
);

// Validate the account creation process
Assert.Equal(DataLakeStoreAccountStatus.Succeeded, responseGet.ProvisioningState);
Assert.NotNull(responseCreate.Id);
Assert.NotNull(responseGet.Id);
Assert.Contains(adlsAccountName, responseGet.Id);
Assert.Contains(adlsAccountName, responseGet.Endpoint);
Assert.Equal(commonData.Location, responseGet.Location);
Assert.Equal(adlsAccountName, responseGet.Name);
Assert.Equal("Microsoft.DataLakeStore/accounts", responseGet.Type);

// Validate firewall state
Assert.Equal(FirewallState.Enabled, responseGet.FirewallState);
Assert.True(responseGet.FirewallRules.Count() == 0);
Assert.Equal(FirewallAllowAzureIpsState.Enabled, responseGet.FirewallAllowAzureIps);

// Validate virtual network state
Assert.True(responseGet.VirtualNetworkRules.Count() == 1);
Assert.Equal(vNetRuleName1, responseGet.VirtualNetworkRules[0].Name);
Assert.Equal(subnetId, responseGet.VirtualNetworkRules[0].SubnetId);

var vnetRule = clientToUse.VirtualNetworkRules.Get(
commonData.ResourceGroupName,
adlsAccountName,
vNetRuleName1
);

Assert.Equal(vNetRuleName1, vnetRule.Name);
Assert.Equal(subnetId, vnetRule.SubnetId);

var updatedSubnetId = "/subscriptions/9e1f0ab2-2f85-49de-9677-9da6f829b914/resourceGroups/lewu-rg/providers/Microsoft.Network/virtualNetworks/lewuVNET/subnets/updatedSubnetId";
//update the virtual network rule to change the subnetId
vnetRule = clientToUse.VirtualNetworkRules.CreateOrUpdate(
commonData.ResourceGroupName,
adlsAccountName,
vNetRuleName1,
new CreateOrUpdateVirtualNetworkRuleParameters
{
SubnetId = updatedSubnetId,
}
);

Assert.Equal(updatedSubnetId, vnetRule.SubnetId);

// Remove the virtual network rule and verify it is gone
clientToUse.VirtualNetworkRules.Delete(
commonData.ResourceGroupName,
adlsAccountName,
vNetRuleName1
);

try
{
vnetRule =
clientToUse.VirtualNetworkRules.Get(
commonData.ResourceGroupName,
adlsAccountName,
vNetRuleName1
);

Assert.True(false, "Attempting to retrieve a deleted vNet rule did not throw.");
}
catch (CloudException e)
{
Assert.Equal(HttpStatusCode.NotFound, e.Response.StatusCode);
}
}
}
}
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class CommonTestFixture : TestBase
public string NoPermissionDataLakeStoreAccountName { get; set; }
public string DataLakeStoreFileSystemAccountName { get; set; }
public string HostUrl { get; set; }
public string Location = "East US 2";
public string Location = "eastus2";
public string AclUserId = "027c28d5-c91d-49f0-98c5-d10134b169b3";
public DataLakeStoreFileSystemManagementClient DataLakeStoreFileSystemClient { get; set; }
private MockContext context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal static class DataLakeStoreCustomizationHelper
/// This constant is used as the default package version to place in the user agent.
/// It should mirror the package version in the project.json file.
/// </summary>
internal const string PackageVersion = "2.4.0-preview";
internal const string PackageVersion = "2.4.1-preview";

internal const string DefaultAdlsFileSystemDnsSuffix = "azuredatalakestore.net";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ public partial class DataLakeStoreAccountManagementClient : ServiceClient<DataLa
/// </summary>
public virtual IFirewallRulesOperations FirewallRules { get; private set; }

/// <summary>
/// Gets the IVirtualNetworkRulesOperations.
/// </summary>
public virtual IVirtualNetworkRulesOperations VirtualNetworkRules { get; private set; }

/// <summary>
/// Gets the ITrustedIdProvidersOperations.
/// </summary>
Expand Down Expand Up @@ -303,6 +308,7 @@ private void Initialize()
{
Accounts = new AccountsOperations(this);
FirewallRules = new FirewallRulesOperations(this);
VirtualNetworkRules = new VirtualNetworkRulesOperations(this);
TrustedIdProviders = new TrustedIdProvidersOperations(this);
Operations = new Operations(this);
Locations = new LocationsOperations(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ internal FirewallRulesOperations(DataLakeStoreAccountManagementClient client)

/// <summary>
/// Deletes the specified firewall rule from the specified Data Lake Store
/// account
/// account.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the Azure resource group.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public static FirewallRule Get(this IFirewallRulesOperations operations, string

/// <summary>
/// Deletes the specified firewall rule from the specified Data Lake Store
/// account
/// account.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -238,7 +238,7 @@ public static void Delete(this IFirewallRulesOperations operations, string resou

/// <summary>
/// Deletes the specified firewall rule from the specified Data Lake Store
/// account
/// account.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ public partial interface IDataLakeStoreAccountManagementClient : System.IDisposa
/// </summary>
IFirewallRulesOperations FirewallRules { get; }

/// <summary>
/// Gets the IVirtualNetworkRulesOperations.
/// </summary>
IVirtualNetworkRulesOperations VirtualNetworkRules { get; }

/// <summary>
/// Gets the ITrustedIdProvidersOperations.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public partial interface IFirewallRulesOperations
Task<AzureOperationResponse<FirewallRule>> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string firewallRuleName, UpdateFirewallRuleParameters parameters = default(UpdateFirewallRuleParameters), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Deletes the specified firewall rule from the specified Data Lake
/// Store account
/// Store account.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the Azure resource group.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
// <auto-generated>
// 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.
// </auto-generated>

namespace Microsoft.Azure.Management.DataLake.Store
{
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

/// <summary>
/// VirtualNetworkRulesOperations operations.
/// </summary>
public partial interface IVirtualNetworkRulesOperations
{
/// <summary>
/// Lists the Data Lake Store virtual network rules within the
/// specified Data Lake Store account.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the Azure resource group.
/// </param>
/// <param name='accountName'>
/// The name of the Data Lake Store account.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.Azure.CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<IPage<VirtualNetworkRule>>> ListByAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Creates or updates the specified virtual network rule. During
/// update, the virtual network rule with the specified name will be
/// replaced with this new virtual network rule.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the Azure resource group.
/// </param>
/// <param name='accountName'>
/// The name of the Data Lake Store account.
/// </param>
/// <param name='virtualNetworkRuleName'>
/// The name of the virtual network rule to create or update.
/// </param>
/// <param name='parameters'>
/// Parameters supplied to create or update the virtual network rule.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.Azure.CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<VirtualNetworkRule>> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string virtualNetworkRuleName, CreateOrUpdateVirtualNetworkRuleParameters parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Gets the specified Data Lake Store virtual network rule.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the Azure resource group.
/// </param>
/// <param name='accountName'>
/// The name of the Data Lake Store account.
/// </param>
/// <param name='virtualNetworkRuleName'>
/// The name of the virtual network rule to retrieve.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.Azure.CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<VirtualNetworkRule>> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string virtualNetworkRuleName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Updates the specified virtual network rule.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the Azure resource group.
/// </param>
/// <param name='accountName'>
/// The name of the Data Lake Store account.
/// </param>
/// <param name='virtualNetworkRuleName'>
/// The name of the virtual network rule to update.
/// </param>
/// <param name='parameters'>
/// Parameters supplied to update the virtual network rule.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.Azure.CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<VirtualNetworkRule>> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string virtualNetworkRuleName, UpdateVirtualNetworkRuleParameters parameters = default(UpdateVirtualNetworkRuleParameters), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Deletes the specified virtual network rule from the specified Data
/// Lake Store account.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the Azure resource group.
/// </param>
/// <param name='accountName'>
/// The name of the Data Lake Store account.
/// </param>
/// <param name='virtualNetworkRuleName'>
/// The name of the virtual network rule to delete.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.Azure.CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse> DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string virtualNetworkRuleName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Lists the Data Lake Store virtual network rules within the
/// specified Data Lake Store account.
/// </summary>
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.Azure.CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<IPage<VirtualNetworkRule>>> ListByAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
Loading