Microsoft.Azure.Commands.HDInsight.GetAzureHDInsightPersistedScriptAction.ExecuteCmdlet C# (CSharp) Method

ExecuteCmdlet() public method

public ExecuteCmdlet ( ) : void
return void
        public override void ExecuteCmdlet()
        {
            if (ResourceGroupName == null)
            {
                ResourceGroupName = GetResourceGroupByAccountName(ClusterName);
            }

            var result = new List<AzureHDInsightRuntimeScriptAction>();

            var persistedScripts = HDInsightManagementClient.ListPersistedScripts(ResourceGroupName, ClusterName);
            if (persistedScripts != null)
            {
                if (string.IsNullOrEmpty(Name))
                {
                    result.AddRange(persistedScripts.Select(p => new AzureHDInsightRuntimeScriptAction(p)));
                }
                else
                {
                    var filteredScripts = persistedScripts.Where(p => string.Equals(p.Name, Name, StringComparison.OrdinalIgnoreCase))
                        .Select(p => new AzureHDInsightRuntimeScriptAction(p));
                    result.AddRange(filteredScripts);
                }
            }

            WriteObject(result, true);
        }
    }
GetAzureHDInsightPersistedScriptAction