Skip to content

Commit d5519da

Browse files
committed
Merge pull request Azure#89 from shuainie/build
Adding IgnoreSslErrors option in HDInsight for HWX testing
2 parents f541384 + 13af346 commit d5519da

27 files changed

+133
-14
lines changed

src/ServiceManagement/HDInsight/Commands.HDInsight.Test/HDInsight/CommandTests/HDInsightGetCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void CommandsNeedCurrentSubscriptionSet()
8888
var getClustersCommand = new GetAzureHDInsightClusterCommand();
8989
try
9090
{
91-
getClustersCommand.GetClient();
91+
getClustersCommand.GetClient(false);
9292
Assert.Fail("Should have failed.");
9393
}
9494
catch (ArgumentNullException noSubscriptionException)

src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightClusterManagementClientSimulatorFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.Simulators
1919
{
2020
public class AzureHDInsightClusterManagementClientSimulatorFactory : IAzureHDInsightClusterManagementClientFactory
2121
{
22-
public IHDInsightClient Create(IHDInsightSubscriptionCredentials credentials)
22+
public IHDInsightClient Create(IHDInsightSubscriptionCredentials credentials, bool ignoreSslErrors)
2323
{
2424
return new AzureHDInsightClusterManagementClientSimulator(credentials);
2525
}

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/GetAzureHDInsightClusterCmdlet.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ public Uri Endpoint
7373
set { this.command.Endpoint = value; }
7474
}
7575

76+
/// <inheritdoc />
77+
[Parameter(Position = 4, Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.")]
78+
public bool IgnoreSslErrors
79+
{
80+
get { return this.command.IgnoreSslErrors; }
81+
set { this.command.IgnoreSslErrors = value; }
82+
}
83+
7684
/// <inheritdoc />
7785
[Parameter(Position = 0, Mandatory = false, HelpMessage = "The name of the HDInsight cluster to locate.", ValueFromPipeline = true,
7886
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)]

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/GetAzureHDInsightJobCmdlet.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ public Uri Endpoint
9595
set { this.command.Endpoint = value; }
9696
}
9797

98+
/// <inheritdoc />
99+
[Parameter(Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.")]
100+
public bool IgnoreSslErrors
101+
{
102+
get { return this.command.IgnoreSslErrors; }
103+
set { this.command.IgnoreSslErrors = value; }
104+
}
105+
98106
/// <inheritdoc />
99107
[Parameter(Mandatory = false, HelpMessage = "The JobID of the jobDetails to get details for.", ValueFromPipeline = true,
100108
ValueFromPipelineByPropertyName = true)]

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/GetAzureHDInsightJobOutputCmdlet.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ public Uri Endpoint
8686
set { this.command.Endpoint = value; }
8787
}
8888

89+
/// <inheritdoc />
90+
[Parameter(Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.")]
91+
public bool IgnoreSslErrors
92+
{
93+
get { return this.command.IgnoreSslErrors; }
94+
set { this.command.IgnoreSslErrors = value; }
95+
}
96+
8997
/// <inheritdoc />
9098
[Parameter(Mandatory = true, HelpMessage = "The JobID of the jobDetails to get details for.", ValueFromPipeline = true,
9199
ValueFromPipelineByPropertyName = true)]

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/GetAzureHDInsightPropertiesCmdlet.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ public Uri Endpoint
7272
set { this.command.Endpoint = value; }
7373
}
7474

75+
/// <inheritdoc />
76+
[Parameter(Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.")]
77+
public bool IgnoreSslErrors
78+
{
79+
get { return this.command.IgnoreSslErrors; }
80+
set { this.command.IgnoreSslErrors = value; }
81+
}
82+
7583
/// <summary>
7684
/// Gets or sets a flag to only show Azure regions available to the subscription.
7785
/// </summary>

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/GrantAzureHDInsightHttpServicesAccessCmdlet.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ public Uri Endpoint
9090
set { this.command.Endpoint = value; }
9191
}
9292

93+
/// <inheritdoc />
94+
[Parameter(Position = 5, Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.")]
95+
public bool IgnoreSslErrors
96+
{
97+
get { return this.command.IgnoreSslErrors; }
98+
set { this.command.IgnoreSslErrors = value; }
99+
}
100+
93101
/// <inheritdoc />
94102
[Parameter(Position = 1, Mandatory = true, HelpMessage = "The Location of the HDInsight cluster to grant http access to.")]
95103
public string Location

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/NewAzureHDInsightClusterCmdlet.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,14 @@ public Uri EndPoint
255255
set { this.command.Endpoint = value; }
256256
}
257257

258+
[Parameter(Position = 19, Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.",
259+
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)]
260+
public bool IgnoreSslErrors
261+
{
262+
get { return this.command.IgnoreSslErrors; }
263+
set { this.command.IgnoreSslErrors = value; }
264+
}
265+
258266
/// <inheritdoc />
259267
[Parameter(Position = 3, Mandatory = true, HelpMessage = "The azure location where the new cluster should be created.",
260268
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)]

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/RemoveClusterHDInsightClusterCmdlet.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ public Uri Endpoint
7171
set { this.command.Endpoint = value; }
7272
}
7373

74+
/// <inheritdoc />
75+
[Parameter(Position = 6, Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.",
76+
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)]
77+
public bool IgnoreSslErrors
78+
{
79+
get { return this.command.IgnoreSslErrors; }
80+
set { this.command.IgnoreSslErrors = value; }
81+
}
82+
7483
/// <inheritdoc />
7584
[Parameter(Position = 0, Mandatory = true, HelpMessage = "The name of the cluster to remove.", ValueFromPipeline = true,
7685
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)]

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/RevokeAzureHDInsightHttpServicesAccessCmdlet.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ public bool Enable
7979
set { this.enableHttpServices = value; }
8080
}
8181

82+
/// <inheritdoc />
83+
[Parameter(Position = 6, Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.",
84+
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)]
85+
public bool IgnoreSslErrors
86+
{
87+
get { return this.command.IgnoreSslErrors; }
88+
set { this.command.IgnoreSslErrors = value; }
89+
}
90+
8291
/// <inheritdoc />
8392
[Parameter(Position = 4, Mandatory = false, HelpMessage = "The Endpoint to use when connecting to Azure.",
8493
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)]

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/SetAzureHDInsightClusterSizeCmdlet.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ public Uri Endpoint
7878
set { command.Endpoint = value; }
7979
}
8080

81+
/// <inheritdoc />
82+
[Parameter(Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.",
83+
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)]
84+
public bool IgnoreSslErrors
85+
{
86+
get { return command.IgnoreSslErrors; }
87+
set { command.IgnoreSslErrors = value; }
88+
}
89+
8190
/// <inheritdoc />
8291
[Parameter(Mandatory = false, HelpMessage = "The name of the HDInsight cluster to set the size of.", ValueFromPipeline = false,
8392
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)]

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/StartAzureHDInsightJobCmdlet.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ public Uri Endpoint
9494
set { this.command.Endpoint = value; }
9595
}
9696

97+
/// <inheritdoc />
98+
[Parameter(Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.",
99+
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetStartJobByNameWithSpecificSubscriptionCredentials)]
100+
public bool IgnoreSslErrors
101+
{
102+
get { return this.command.IgnoreSslErrors; }
103+
set { this.command.IgnoreSslErrors = value; }
104+
}
105+
97106
/// <inheritdoc />
98107
[Parameter(Mandatory = true, Position = 2, HelpMessage = "The jobDetails definition to start on the Azure HDInsight cluster.",
99108
ValueFromPipeline = true)]

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/StopAzureHDInsightJobCmdlet.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ public Uri Endpoint
9393
set { this.command.Endpoint = value; }
9494
}
9595

96+
[Parameter(Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.",
97+
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetStartJobByNameWithSpecificSubscriptionCredentials)]
98+
public bool IgnoreSslErrors
99+
{
100+
get { return this.command.IgnoreSslErrors; }
101+
set { this.command.IgnoreSslErrors = value; }
102+
}
103+
96104
/// <inheritdoc />
97105
[Parameter(Mandatory = true, HelpMessage = "The JobID of the jobDetails to stop.", ValueFromPipeline = true)]
98106
[Alias(AzureHdInsightPowerShellConstants.JobId)]

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/UseAzureHDInsightClusterCmdlet.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ public Uri Endpoint
7575
set { this.command.Endpoint = value; }
7676
}
7777

78+
/// <inheritdoc />
79+
[Parameter(Position = 5, Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.",
80+
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)]
81+
public bool IgnoreSslErrors
82+
{
83+
get { return this.command.IgnoreSslErrors; }
84+
set { this.command.IgnoreSslErrors = value; }
85+
}
86+
7887
/// <inheritdoc />
7988
[Parameter(Position = 0, Mandatory = true, HelpMessage = "The name of the HDInsight cluster to locate.", ValueFromPipeline = true,
8089
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)]

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/WaitAzureHDInsightJobCmdlet.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ public Uri Endpoint
9999
set { this.command.Endpoint = value; }
100100
}
101101

102+
/// <inheritdoc />
103+
[Parameter(Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.",
104+
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetJobHistoryByNameWithSpecificSubscriptionCredentials)]
105+
public bool IgnoreSslErrors
106+
{
107+
get { return this.command.IgnoreSslErrors; }
108+
set { this.command.IgnoreSslErrors = value; }
109+
}
110+
102111
/// <inheritdoc />
103112
[Parameter(Mandatory = true, HelpMessage = "The Jobs to wait for.", ValueFromPipeline = true,
104113
ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetWaitJobByJob)]

src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/GetAzureHDInsightClusterCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal class GetAzureHDInsightClusterCommand : AzureHDInsightClusterCommand<Az
2525
{
2626
public override async Task EndProcessing()
2727
{
28-
IHDInsightClient client = this.GetClient();
28+
IHDInsightClient client = this.GetClient(this.IgnoreSslErrors);
2929
if (!string.IsNullOrWhiteSpace(this.Name))
3030
{
3131
var azureCluster = await client.GetClusterAsync(this.Name);

src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/GetAzureHDInsightPropertiesCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ internal class GetAzureHDInsightPropertiesCommand : AzureHDInsightClusterCommand
3030

3131
public override async Task EndProcessing()
3232
{
33-
IHDInsightClient client = this.GetClient();
33+
IHDInsightClient client = this.GetClient(IgnoreSslErrors);
3434
var capabilities = await client.ListResourceProviderPropertiesAsync();
3535
capabilities = capabilities.ToList();
3636
var azureCapabilities = new AzureHDInsightCapabilities(capabilities);

src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/ManageAzureHDInsightHttpAccessCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public override async Task EndProcessing()
3939
this.Name.ArgumentNotNullOrEmpty("Name");
4040
this.Location.ArgumentNotNullOrEmpty("Location");
4141

42-
IHDInsightClient client = this.GetClient();
42+
IHDInsightClient client = this.GetClient(IgnoreSslErrors);
4343
if (this.Enable)
4444
{
4545
this.Credential.ArgumentNotNull("Credential");

src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/NewAzureHDInsightClusterCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public NewAzureHDInsightClusterCommand()
132132

133133
public override async Task EndProcessing()
134134
{
135-
IHDInsightClient client = this.GetClient();
135+
IHDInsightClient client = this.GetClient(IgnoreSslErrors);
136136
client.ClusterProvisioning += this.ClientOnClusterProvisioning;
137137
ClusterCreateParametersV2 createClusterRequest = this.GetClusterCreateParameters();
138138
var cluster = await client.CreateClusterAsync(createClusterRequest);

src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/RemoveAzureHDInsightClusterCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal class RemoveAzureHDInsightClusterCommand : AzureHDInsightClusterCommand
2525

2626
public override async Task EndProcessing()
2727
{
28-
IHDInsightClient client = this.GetClient();
28+
IHDInsightClient client = this.GetClient(IgnoreSslErrors);
2929
await client.DeleteClusterAsync(this.Name);
3030
}
3131
}

src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/SetAzureHdInsightClusterSizeCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public override async Task EndProcessing()
4545
{
4646
Name.ArgumentNotNull("Name");
4747
Location.ArgumentNotNull("Location");
48-
var client = GetClient();
48+
var client = GetClient(IgnoreSslErrors);
4949
var cluster = await client.ChangeClusterSizeAsync(Name, Location, ClusterSizeInNodes);
5050
if (cluster != null)
5151
{

src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/UseAzureHDInsightClusterCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ internal class UseAzureHDInsightClusterCommand : AzureHDInsightClusterCommand<Az
3333
public override async Task EndProcessing()
3434
{
3535
this.Name.ArgumentNotNullOrEmpty("Name");
36-
IHDInsightClient client = this.GetClient();
36+
IHDInsightClient client = this.GetClient(IgnoreSslErrors);
3737
var cluster = await client.GetClusterAsync(this.Name);
3838
var connection = new AzureHDInsightClusterConnection();
3939
ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)));

src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightClientFactory.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightCl
1818
{
1919
internal class AzureHDInsightClusterManagementClientFactory : IAzureHDInsightClusterManagementClientFactory
2020
{
21-
public IHDInsightClient Create(IHDInsightSubscriptionCredentials credentials)
21+
public IHDInsightClient Create(IHDInsightSubscriptionCredentials credentials, bool ignoreSslErrors)
2222
{
23-
return HDInsightClient.Connect(credentials);
23+
var client = HDInsightClient.Connect(credentials);
24+
client.IgnoreSslErrors = ignoreSslErrors;
25+
return client;
2426
}
2527
}
2628
}

src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightClusterCommandBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public override void Cancel()
3939
this.tokenSource.Cancel();
4040
}
4141

42-
internal IHDInsightClient GetClient()
42+
internal IHDInsightClient GetClient(bool ignoreSslErrors = false)
4343
{
4444
this.CurrentSubscription.ArgumentNotNull("CurrentSubscription");
4545

@@ -55,7 +55,7 @@ internal IHDInsightClient GetClient()
5555
subscriptionCredentials.Endpoint = this.Endpoint;
5656
}
5757

58-
var clientInstance = ServiceLocator.Instance.Locate<IAzureHDInsightClusterManagementClientFactory>().Create(subscriptionCredentials);
58+
var clientInstance = ServiceLocator.Instance.Locate<IAzureHDInsightClusterManagementClientFactory>().Create(subscriptionCredentials, ignoreSslErrors);
5959
clientInstance.SetCancellationSource(this.tokenSource);
6060
if (this.Logger.IsNotNull())
6161
{

src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public virtual CancellationToken CancellationToken
3535

3636
public Uri Endpoint { get; set; }
3737

38+
public bool IgnoreSslErrors { get; set; }
39+
3840
public ILogWriter Logger { get; set; }
3941

4042
public string Subscription { get; set; }

src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightClusterManagementClientFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightCl
1515
{
1616
internal interface IAzureHDInsightClusterManagementClientFactory
1717
{
18-
IHDInsightClient Create(IHDInsightSubscriptionCredentials credentials);
18+
IHDInsightClient Create(IHDInsightSubscriptionCredentials credentials, bool ignoreSslErrors);
1919
}
2020
}

src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightCommonCommandBase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ internal interface IAzureHDInsightCommonCommandBase
3535
/// </summary>
3636
Uri Endpoint { get; set; }
3737

38+
/// <summary>
39+
/// Gets or sets rule for client SSL errors.
40+
/// </summary>
41+
bool IgnoreSslErrors { get; set; }
42+
3843
/// <summary>
3944
/// Gets or sets a logger to write log messages to.
4045
/// </summary>

0 commit comments

Comments
 (0)