public override void ExecuteCmdlet() { var updateGatewaySettingsParameters = new UpdateGatewaySettingsParameters { IsCredentialEnabled = true, UserName = HttpCredential.UserName, Password = HttpCredential.Password.ConvertToString() }; if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new ResourceIdentifier(ResourceId); this.Name = resourceIdentifier.ResourceName; this.ResourceGroupName = resourceIdentifier.ResourceGroupName; } if (this.IsParameterBound(c => c.InputObject)) { this.Name = this.InputObject.Name; this.ResourceGroupName = this.InputObject.ResourceGroup; } if (ResourceGroupName == null) { ResourceGroupName = GetResourceGroupByAccountName(Name); } if (ShouldProcess(Name, "set gateway http credential")) { HDInsightManagementClient.UpdateGatewayCredential(ResourceGroupName, Name, updateGatewaySettingsParameters); WriteObject(new AzureHDInsightGatewaySettings(HDInsightManagementClient.GetGatewaySettings(ResourceGroupName, Name))); } }
public override void ExecuteCmdlet() { var httpParams = new HttpSettingsParameters { HttpUserEnabled = true, HttpUsername = HttpCredential.UserName, HttpPassword = HttpCredential.Password.ConvertToString() }; if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new ResourceIdentifier(ResourceId); this.Name = resourceIdentifier.ResourceName; this.ResourceGroupName = resourceIdentifier.ResourceGroupName; } if (this.IsParameterBound(c => c.InputObject)) { this.Name = this.InputObject.Name; this.ResourceGroupName = this.InputObject.ResourceGroup; } if (ResourceGroupName == null) { ResourceGroupName = GetResourceGroupByAccountName(Name); } if (ShouldProcess(Name, "set gateway http credential")) { var result = HDInsightManagementClient.UpdateGatewayCredential(ResourceGroupName, Name, httpParams); if (result.State == AsyncOperationState.Failed) { WriteError(new ErrorRecord(new Exception($"{result.ErrorInfo?.Code}: {result.ErrorInfo?.Message}"), string.Empty, ErrorCategory.InvalidArgument, null)); } else { WriteObject(HDInsightManagementClient.GetGatewaySettings(ResourceGroupName, Name)); } } }