Ejemplo n.º 1
0
        public override void ExecuteCmdlet()
        {
            if (ResourceGroupName == null)
            {
                ResourceGroupName = GetResourceGroupByAccountName(ClusterName);
            }

            var scriptAction = new RuntimeScriptAction
            {
                Name            = Name,
                Parameters      = Parameters,
                Roles           = NodeTypes.Select(n => n.ToString()).ToList(),
                Uri             = Uri,
                ApplicationName = ApplicationName
            };

            var scriptActions = new List <RuntimeScriptAction> {
                scriptAction
            };

            var executeScriptActionParameters = new ExecuteScriptActionParameters
            {
                ScriptActions    = scriptActions,
                PersistOnSuccess = PersistOnSuccess.IsPresent
            };

            var operationResource = HDInsightManagementClient.ExecuteScriptActions(ResourceGroupName, ClusterName, executeScriptActionParameters);

            WriteObject(new AzureHDInsightRuntimeScriptActionOperationResource(scriptAction, operationResource));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Begins Executing script actions on specified HDInsight Running cluster
        /// </summary>
        /// <param name='resourceGroupName'>
        /// Required. The name of the resource group.
        /// </param>
        /// <param name='clusterName'>
        /// Required. The name of the cluster.
        /// </param>
        /// <param name='scriptActions'>
        /// Required. The list of script actions that needs to be executed.
        /// </param>
        /// <param name='persistOnSuccess'>
        /// Required. Flag indicating if the script needs to be persisted.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// The cluster long running operation response.
        /// </returns>
        public async Task <AzureOperationResponse> BeginExecuteScriptActionsAsync(string resourceGroupName, string clusterName, IList <RuntimeScriptAction> scriptActions,
                                                                                  bool persistOnSuccess, CancellationToken cancellationToken)
        {
            var executeScriptActionsParams = new ExecuteScriptActionParameters {
                ScriptActions = scriptActions, PersistOnSuccess = persistOnSuccess
            };

            return(await BeginExecuteScriptActionsWithHttpMessagesAsync(resourceGroupName, clusterName, executeScriptActionsParams, null, cancellationToken).ConfigureAwait(false));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Begins Executing script actions on specified HDInsight Running cluster
 /// </summary>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group.
 /// </param>
 /// <param name='clusterName'>
 /// Required. The name of the cluster.
 /// </param>
 /// <param name='scriptActions'>
 /// Required. The list of script actions that needs to be executed.
 /// </param>
 /// <param name='persistOnSuccess'>
 /// Required. Flag indicating if the script needs to be persisted.
 /// </param>
 /// <param name='cancellationToken'>
 /// Cancellation token.
 /// </param>
 /// <returns>
 /// The cluster long running operation response.
 /// </returns>
 public async Task <HDInsightOperationResponse> BeginExecuteScriptActionsAsync(string resourceGroupName, string clusterName, IList <RuntimeScriptAction> scriptActions,
                                                                               bool persistOnSuccess, CancellationToken cancellationToken)
 {
     try
     {
         var executeScriptActionsParams = new ExecuteScriptActionParameters {
             ScriptActions = scriptActions, PersistOnSuccess = persistOnSuccess
         };
         return(await BeginExecuteScriptActionsAsync(resourceGroupName, clusterName, executeScriptActionsParams, cancellationToken));
     }
     catch (Exception ex)
     {
         throw new CloudException(ex.Message);
     }
 }
Ejemplo n.º 4
0
        public override void ExecuteCmdlet()
        {
            if (ResourceGroupName == null)
            {
                ResourceGroupName = GetResourceGroupByAccountName(ClusterName);
            }

            var scriptAction = new RuntimeScriptAction
            {
                Name       = Name,
                Parameters = Parameters,
                Roles      = NodeTypes.Select(n => n.ToString()).ToList(),
                Uri        = Uri.IsAbsoluteUri ? Uri.AbsoluteUri : Uri.ToString()
            };

            var scriptActions = new List <RuntimeScriptAction> {
                scriptAction
            };

            var executeScriptActionParameters = new ExecuteScriptActionParameters
            {
                ScriptActions    = scriptActions,
                PersistOnSuccess = PersistOnSuccess.IsPresent
            };

            ErrorResponseException errorResponse = null;

            try
            {
                HDInsightManagementClient.ExecuteScriptActions(ResourceGroupName, ClusterName, executeScriptActionParameters);
            }
            catch (ErrorResponseException ex)
            {
                errorResponse = ex;
            }

            WriteObject(new AzureHDInsightRuntimeScriptActionOperationResource(scriptAction, errorResponse));
        }
Ejemplo n.º 5
0
        private ExecuteScriptActionParameters GetExecuteScriptActionParams(bool persistOnSuccess, string scriptName, string scriptUri)
        {
            var scriptActions = new List <RuntimeScriptAction>();

            scriptActions.Add(new RuntimeScriptAction
            {
                Name  = scriptName,
                Uri   = new System.Uri(scriptUri),
                Roles = new List <string>()
                {
                    "headnode", "workernode"
                }
            }
                              );

            var scriptActionParams = new ExecuteScriptActionParameters
            {
                ScriptActions    = scriptActions,
                PersistOnSuccess = persistOnSuccess
            };

            return(scriptActionParams);
        }
Ejemplo n.º 6
0
 public virtual void ExecuteScriptActions(string resourceGroupName, string clusterName, ExecuteScriptActionParameters executeScriptActionParameters)
 {
     HdInsightManagementClient.Clusters.ExecuteScriptActions(resourceGroupName, clusterName, executeScriptActionParameters);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Executes script actions on the specified HDInsight cluster.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='clusterName'>
 /// The name of the cluster.
 /// </param>
 /// <param name='parameters'>
 /// The parameters for executing script actions.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task BeginExecuteScriptActionsAsync(this IClustersOperations operations, string resourceGroupName, string clusterName, ExecuteScriptActionParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.BeginExecuteScriptActionsWithHttpMessagesAsync(resourceGroupName, clusterName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Executes script actions on the specified HDInsight cluster.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='clusterName'>
 /// The name of the cluster.
 /// </param>
 /// <param name='parameters'>
 /// The parameters for executing script actions.
 /// </param>
 public static void BeginExecuteScriptActions(this IClustersOperations operations, string resourceGroupName, string clusterName, ExecuteScriptActionParameters parameters)
 {
     operations.BeginExecuteScriptActionsAsync(resourceGroupName, clusterName, parameters).GetAwaiter().GetResult();
 }
Ejemplo n.º 9
0
 public virtual OperationResource ExecuteScriptActions(string resourceGroupName, string clusterName, ExecuteScriptActionParameters executeScriptActionParameters)
 {
     return(HdInsightManagementClient.Clusters.ExecuteScriptActions(resourceGroupName, clusterName, executeScriptActionParameters));
 }