示例#1
0
        public override void ExecuteCmdlet()
        {
            var httpParams = new HttpSettingsParameters
            {
                HttpUserEnabled = false
            };

            HDInsightManagementClient.ConfigureHttp(ResourceGroupName, ClusterName, httpParams);
            WriteObject(HDInsightManagementClient.GetConnectivitySettings(ResourceGroupName, ClusterName));
        }
示例#2
0
        public override void ExecuteCmdlet()
        {
            var httpParams = new HttpSettingsParameters
            {
                HttpUserEnabled = true,
                HttpUsername    = HttpCredential.UserName,
                HttpPassword    = HttpCredential.Password.ConvertToString()
            };

            HDInsightManagementClient.ConfigureHttp(ResourceGroupName, ClusterName, httpParams);
            WriteObject(HDInsightManagementClient.GetConnectivitySettings(ResourceGroupName, ClusterName));
        }
示例#3
0
        public void TestEnableDisableDisableHttp()
        {
            var handler = new RecordedDelegatingHandler {
                StatusCodeToReturn = HttpStatusCode.OK
            };

            using (var context = UndoContext.Current)
            {
                context.Start();

                var client = HDInsightManagementTestUtilities.GetHDInsightManagementClient(handler);
                var resourceManagementClient = HDInsightManagementTestUtilities.GetResourceManagementClient(handler);

                var          resourceGroup = HDInsightManagementTestUtilities.CreateResourceGroup(resourceManagementClient);
                const string dnsname       = "hdisdk-httptest3";

                var spec = GetClusterSpecHelpers.GetPaasClusterSpec();

                var cluster = client.Clusters.Create(resourceGroup, dnsname, spec);

                string errorMessage = cluster.Cluster.Properties.ErrorInfos.Any()
                    ? cluster.Cluster.Properties.ErrorInfos[0].Message
                    : String.Empty;

                Assert.True(cluster.Cluster.Properties.ClusterState.Equals("Running", StringComparison.OrdinalIgnoreCase),
                            String.Format("Cluster Creation Failed ErrorInfo: {0}", errorMessage));

                HDInsightManagementTestUtilities.WaitForClusterToMoveToRunning(resourceGroup, dnsname, client);

                var httpSettings = client.Clusters.GetConnectivitySettings(resourceGroup, dnsname);
                Assert.True(httpSettings.HttpUserEnabled);

                var httpParams = new HttpSettingsParameters
                {
                    HttpUserEnabled = false,
                };

                client.Clusters.ConfigureHttpSettings(resourceGroup, dnsname, httpParams);
                httpSettings = client.Clusters.GetConnectivitySettings(resourceGroup, dnsname);
                Assert.False(httpSettings.HttpUserEnabled);

                client.Clusters.ConfigureHttpSettings(resourceGroup, dnsname, httpParams);

                httpSettings = client.Clusters.GetConnectivitySettings(resourceGroup, dnsname);
                Assert.False(httpSettings.HttpUserEnabled);

                client.Clusters.Delete(resourceGroup, dnsname);
            }
        }
        protected override void ProcessRecord()
        {
            var httpParams = new HttpSettingsParameters
            {
                HttpUserEnabled = false
            };

            if (ResourceGroupName == null)
            {
                ResourceGroupName = GetResourceGroupByAccountName(ClusterName);
            }

            HDInsightManagementClient.ConfigureHttp(ResourceGroupName, ClusterName, httpParams);
            WriteObject(HDInsightManagementClient.GetConnectivitySettings(ResourceGroupName, ClusterName));
        }
示例#5
0
        public void TestEnableEnableHttp()
        {
            var handler = new RecordedDelegatingHandler {
                StatusCodeToReturn = HttpStatusCode.OK
            };

            using (var context = UndoContext.Current)
            {
                context.Start();

                var client = HDInsightManagementTestUtilities.GetHDInsightManagementClient(handler);
                var resourceManagementClient = HDInsightManagementTestUtilities.GetResourceManagementClient(handler);

                var          resourceGroup = HDInsightManagementTestUtilities.CreateResourceGroup(resourceManagementClient);
                const string dnsname       = "hdisdk-httptest3";

                var spec = GetClusterSpecHelpers.GetPaasClusterSpec();

                client.Clusters.Create(resourceGroup, dnsname, spec);

                var httpSettings = client.Clusters.GetConnectivitySettings(resourceGroup, dnsname);

                Assert.True(httpSettings.HttpUserEnabled);

                var httpParams = new HttpSettingsParameters
                {
                    HttpUserEnabled = true,
                    HttpUsername    = "******",
                    HttpPassword    = "******"
                };

                try
                {
                    client.Clusters.ConfigureHttpSettings(resourceGroup, dnsname, httpParams);
                }
                catch (CloudException ex)
                {
                    Assert.Equal(ex.Response.StatusCode, HttpStatusCode.Conflict);
                }
                httpSettings = client.Clusters.GetConnectivitySettings(resourceGroup, dnsname);
                Assert.True(httpSettings.HttpUserEnabled);

                var result = client.Clusters.Delete(resourceGroup, dnsname);
                //Assert.Equal(result.StatusCode, HttpStatusCode.NoContent);
            }
        }
        protected override void ProcessRecord()
        {
            var httpParams = new HttpSettingsParameters
            {
                HttpUserEnabled = true,
                HttpUsername    = HttpCredential.UserName,
                HttpPassword    = HttpCredential.Password.ConvertToString()
            };

            if (ResourceGroupName == null)
            {
                ResourceGroupName = GetResourceGroupByAccountName(ClusterName);
            }

            HDInsightManagementClient.ConfigureHttp(ResourceGroupName, ClusterName, httpParams);
            WriteObject(HDInsightManagementClient.GetConnectivitySettings(ResourceGroupName, ClusterName));
        }
示例#7
0
        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));
                }
            }
        }
        public void TestEnableDisableDisableHttp()
        {
            var handler = new RecordedDelegatingHandler {
                StatusCodeToReturn = HttpStatusCode.OK
            };

            using (var context = UndoContext.Current)
            {
                context.Start();

                var client = HDInsightManagementTestUtilities.GetHDInsightManagementClient(handler);
                var resourceManagementClient = HDInsightManagementTestUtilities.GetResourceManagementClient(handler);

                var          resourceGroup = HDInsightManagementTestUtilities.CreateResourceGroup(resourceManagementClient);
                const string dnsname       = "hdisdk-httptest3";

                var spec = GetClusterSpecHelpers.GetPaasClusterSpec();

                client.Clusters.Create(resourceGroup, dnsname, spec);

                var httpSettings = client.Clusters.GetConnectivitySettings(resourceGroup, dnsname);
                Assert.True(httpSettings.HttpUserEnabled);

                var httpParams = new HttpSettingsParameters
                {
                    HttpUserEnabled = false,
                };

                client.Clusters.ConfigureHttpSettings(resourceGroup, dnsname, httpParams);
                httpSettings = client.Clusters.GetConnectivitySettings(resourceGroup, dnsname);
                Assert.False(httpSettings.HttpUserEnabled);

                client.Clusters.ConfigureHttpSettings(resourceGroup, dnsname, httpParams);

                httpSettings = client.Clusters.GetConnectivitySettings(resourceGroup, dnsname);
                Assert.False(httpSettings.HttpUserEnabled);

                client.Clusters.Delete(resourceGroup, dnsname);
            }
        }
示例#9
0
 public virtual OperationResource ConfigureHttp(string resourceGroupName, string clusterName, HttpSettingsParameters httpSettings)
 {
     return(HdInsightManagementClient.Clusters.ConfigureHttpSettings(resourceGroupName, clusterName, httpSettings));
 }
 /// <summary>
 /// Begins configuring the HTTP settings on the specified cluster.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.HDInsight.IClusterOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group.
 /// </param>
 /// <param name='clusterName'>
 /// Required. The name of the cluster.
 /// </param>
 /// <param name='httpSettingsParameters'>
 /// Required. The name of the resource group.
 /// </param>
 /// <returns>
 /// The cluster long running operation response.
 /// </returns>
 public static Task <HDInsightOperationResponse> BeginConfiguringHttpSettingsAsync(this IClusterOperations operations, string resourceGroupName, string clusterName, HttpSettingsParameters httpSettingsParameters)
 {
     return(operations.BeginConfiguringHttpSettingsAsync(resourceGroupName, clusterName, httpSettingsParameters, CancellationToken.None));
 }
 /// <summary>
 /// Begins configuring the HTTP settings on the specified cluster.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.HDInsight.IClusterOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group.
 /// </param>
 /// <param name='clusterName'>
 /// Required. The name of the cluster.
 /// </param>
 /// <param name='httpSettingsParameters'>
 /// Required. The name of the resource group.
 /// </param>
 /// <returns>
 /// The cluster long running operation response.
 /// </returns>
 public static HDInsightOperationResponse BeginConfiguringHttpSettings(this IClusterOperations operations, string resourceGroupName, string clusterName, HttpSettingsParameters httpSettingsParameters)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IClusterOperations)s).BeginConfiguringHttpSettingsAsync(resourceGroupName, clusterName, httpSettingsParameters);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 public virtual OperationResource UpdateGatewayCredential(string resourceGroupName, string clusterName, HttpSettingsParameters httpSettings)
 {
     return(HdInsightManagementClient.Clusters.UpdateGatewaySettings(resourceGroupName, clusterName, httpSettings));
 }
示例#13
0
 /// <summary>
 /// Configures the HTTP settings on the specified cluster.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.HDInsight.IClusterOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group.
 /// </param>
 /// <param name='clusterName'>
 /// Required. The name of the cluster.
 /// </param>
 /// <param name='httpSettingsParameters'>
 /// Required. The name of the resource group.
 /// </param>
 /// <returns>
 /// The azure async operation response.
 /// </returns>
 public static Task <OperationResource> ConfigureHttpSettingsAsync(this IClusterOperations operations, string resourceGroupName, string clusterName, HttpSettingsParameters httpSettingsParameters)
 {
     return(operations.ConfigureHttpSettingsAsync(resourceGroupName, clusterName, httpSettingsParameters, CancellationToken.None));
 }