@@ -459,7 +459,46 @@ public Model.DscNode GetDscNodeById(
459
459
460
460
return dscNodes . Select ( dscNode => new Model . DscNode ( resourceGroupName , automationAccountName , dscNode ) ) ;
461
461
}
462
-
462
+
463
+ public IEnumerable < Model . DscNode > ListDscNodesByConfiguration (
464
+ string resourceGroupName ,
465
+ string automationAccountName ,
466
+ string configurationName ,
467
+ string status )
468
+ {
469
+ Requires . Argument ( "ResourceGroupName" , resourceGroupName ) . NotNull ( ) ;
470
+ Requires . Argument ( "AutomationAccountName" , automationAccountName ) . NotNull ( ) ;
471
+ Requires . Argument ( "ConfigurationName" , configurationName ) . NotNull ( ) ;
472
+
473
+ IEnumerable < Model . DscNode > listOfNodes = Enumerable . Empty < Model . DscNode > ( ) ;
474
+
475
+ // first get the list of node configurations for the given configuration
476
+ IEnumerable < Model . NodeConfiguration > listOfNodeConfigurations = this . EnumerateNodeConfigurationsByConfigurationName (
477
+ resourceGroupName ,
478
+ automationAccountName ,
479
+ configurationName ) ;
480
+
481
+ IEnumerable < Model . DscNode > listOfNodesForGivenNodeConfiguration ;
482
+
483
+ // for each nodeconfiguration, get the list of nodes and concatenate
484
+ foreach ( var nodeConfiguration in listOfNodeConfigurations )
485
+ {
486
+ listOfNodesForGivenNodeConfiguration =
487
+ this . ListDscNodesByNodeConfiguration (
488
+ resourceGroupName ,
489
+ automationAccountName ,
490
+ nodeConfiguration . Name ,
491
+ status ) ;
492
+
493
+ if ( listOfNodesForGivenNodeConfiguration != null )
494
+ {
495
+ listOfNodes = listOfNodes . Concat ( listOfNodesForGivenNodeConfiguration ) ;
496
+ }
497
+ }
498
+
499
+ return listOfNodes ;
500
+ }
501
+
463
502
public IEnumerable < Model . DscNode > ListDscNodes (
464
503
string resourceGroupName ,
465
504
string automationAccountName ,
@@ -890,6 +929,37 @@ public Model.NodeConfiguration GetNodeConfiguration(string resourceGroupName, st
890
929
}
891
930
}
892
931
932
+ /// <summary>
933
+ /// Enumerate the list of NodeConfigurations for given configuration - without any rollup status
934
+ /// </summary>
935
+ /// <param name="resourceGroupName">Resource group name</param>
936
+ /// <param name="automationAccountName">Automation account</param>
937
+ /// <param name="configurationName">Name of configuration</param>
938
+ /// <returns>List of NodeConfigurations</returns>
939
+ private IEnumerable < Model . NodeConfiguration > EnumerateNodeConfigurationsByConfigurationName ( string resourceGroupName , string automationAccountName , string configurationName )
940
+ {
941
+ using ( var request = new RequestSettings ( this . automationManagementClient ) )
942
+ {
943
+ IEnumerable < AutomationManagement . Models . DscNodeConfiguration > nodeConfigModels ;
944
+
945
+ nodeConfigModels = AutomationManagementClient . ContinuationTokenHandler (
946
+ skipToken =>
947
+ {
948
+ var response = this . automationManagementClient . NodeConfigurations . List (
949
+ resourceGroupName ,
950
+ automationAccountName ,
951
+ new AutomationManagement . Models . DscNodeConfigurationListParameters
952
+ {
953
+ ConfigurationName = configurationName
954
+ } ) ;
955
+ return new ResponseWithSkipToken < AutomationManagement . Models . DscNodeConfiguration > ( response , response . DscNodeConfigurations ) ;
956
+ } ) ;
957
+
958
+
959
+ return nodeConfigModels . Select ( nodeConfigModel => new Commands . Automation . Model . NodeConfiguration ( automationAccountName , nodeConfigModel ) ) ;
960
+ }
961
+ }
962
+
893
963
#endregion
894
964
895
965
#region privatemethods
0 commit comments