Exemple #1
0
        protected override void ProcessRecord()
        {
            var qb = new QuerystringBuilder();

            var           environments = new Model.ProtectionSource.EnvironmentEnum[] { Model.ProtectionSource.EnvironmentEnum.KPhysical };
            List <string> envs         = environments.ToList().ConvertAll <string>(x => x.ToString().First().ToString().ToLower() + x.ToString().Substring(1));

            qb.Add("environment", string.Join(",", envs));

            var url     = $"/public/protectionSources{qb.Build()}";
            var results = Session.ApiClient.Get <IEnumerable <ProtectionSourceNode> >(url);

            results = FlattenNodes(results);

            List <AgentInformation> agents = new List <AgentInformation>();

            foreach (var result in results)
            {
                if (result.ProtectionSource.PhysicalProtectionSource.Agents != null)
                {
                    agents.AddRange(result.ProtectionSource.PhysicalProtectionSource.Agents);
                }
            }

            WriteObject(agents, true);
        }
Exemple #2
0
 private void DecideToAppendNode(ProtectionSourceNode node, ref List <ProtectionSourceNode> result)
 {
     // Ensure that we are processing only the requested items type passed in the environment variable
     Model.ProtectionSource.EnvironmentEnum resp
         = System.Array.Find(this.Environments, element => element == node.ProtectionSource.Environment);
     if (resp == node.ProtectionSource.Environment)
     {
         result.Add(node);
     }
 }