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

            var result = new List <AzureHDInsightRuntimeScriptActionDetail>();

            if (ScriptExecutionId.HasValue)
            {
                var executionDetailResponse = HDInsightManagementClient.GetScriptExecutionDetail(ResourceGroupName, ClusterName, ScriptExecutionId.Value);
                if (executionDetailResponse != null && executionDetailResponse.RuntimeScriptActionDetail != null)
                {
                    result.Add(new AzureHDInsightRuntimeScriptActionDetail(executionDetailResponse.RuntimeScriptActionDetail));
                }
            }
            else
            {
                var executionHistory = HDInsightManagementClient.ListScriptExecutionHistory(ResourceGroupName, ClusterName);
                if (executionHistory != null)
                {
                    result.AddRange(executionHistory.Select(h => new AzureHDInsightRuntimeScriptActionDetail(h)));
                }
            }

            WriteObject(result, true);
        }