FilterResources() public méthode

Filters a given resource group resources.
public FilterResources ( FilterResourcesOptions options ) : List
options FilterResourcesOptions The filtering options
Résultat List
        protected string GetResourceGroupName(string vaultName)
        {
            var localResourcesClient = new PSResourceManagerModels.ResourcesClient(DefaultContext)
            {
                VerboseLogger = WriteVerboseWithTimestamp,
                ErrorLogger   = WriteVerboseWithTimestamp,
                WarningLogger = WriteWarningWithTimestamp
            };

            string rg = null;
            var    resourcesByName = localResourcesClient.FilterResources(
                new PSResourceManagerModels.FilterResourcesOptions()
            {
                ResourceType = Constants.KeyVaultType
            });

            if (resourcesByName != null && resourcesByName.Count > 0)
            {
                var vault = resourcesByName.FirstOrDefault(
                    r => r.Name.Equals(vaultName, StringComparison.OrdinalIgnoreCase));
                if (vault != null)
                {
                    rg = new PSResourceManagerModels.ResourceIdentifier(vault.Id).ResourceGroupName;
                }
            }

            return(rg);
        }
 public static PSResourceGroup ToPSResourceGroup(this ResourceGroup resourceGroup, ResourcesClient client)
 {
     List<PSResource> resources = client.FilterResources(new FilterResourcesOptions { ResourceGroup = resourceGroup.Name })
         .Select(r => r.ToPSResource(client)).ToList();
     return new PSResourceGroup()
     {
         ResourceGroupName = resourceGroup.Name,
         Location = resourceGroup.Location,
         Resources = resources,
         ResourcesTable = ConstructResourcesTable(resources),
         ProvisioningState = resourceGroup.ProvisioningState
     };
 }
 public static PSResourceGroup ToPSResourceGroup(this ResourceGroup resourceGroup, ResourcesClient client)
 {
     List<PSResource> resources = client.FilterResources(new FilterResourcesOptions { ResourceGroup = resourceGroup.Name })
         .Select(r => r.ToPSResource(client)).ToList();
     return new PSResourceGroup
     {
         ResourceGroupName = resourceGroup.Name,
         Location = resourceGroup.Location,
         Resources = resources,
         ProvisioningState = resourceGroup.ProvisioningState,
         Tags = TagsConversionHelper.CreateTagHashtable(resourceGroup.Tags),
     };
 }
Exemple #4
0
        public static PSResourceGroup ToPSResourceGroup(this ResourceGroup resourceGroup, ResourcesClient client)
        {
            List <PSResource> resources = client.FilterResources(new FilterResourcesOptions {
                ResourceGroup = resourceGroup.Name
            })
                                          .Select(r => r.ToPSResource(client)).ToList();

            return(new PSResourceGroup
            {
                ResourceGroupName = resourceGroup.Name,
                Location = resourceGroup.Location,
                Resources = resources,
                ProvisioningState = resourceGroup.ProvisioningState,
                Tags = TagsConversionHelper.CreateTagHashtable(resourceGroup.Tags),
            });
        }
        public static PSResourceGroup ToPSResourceGroup(this ResourceGroup resourceGroup, ResourcesClient client)
        {
            List <PSResource> resources = client.FilterResources(new FilterResourcesOptions {
                ResourceGroup = resourceGroup.Name
            })
                                          .Select(r => r.ToPSResource(client)).ToList();

            return(new PSResourceGroup()
            {
                ResourceGroupName = resourceGroup.Name,
                Location = resourceGroup.Location,
                Resources = resources,
                ResourcesTable = ConstructResourcesTable(resources),
                ProvisioningState = resourceGroup.ProvisioningState
            });
        }
        public static PSResourceGroup ToPSResourceGroup(this ResourceGroupExtended resourceGroup, ResourcesClient client, bool detailed)
        {
            var result = new PSResourceGroup
            {
                ResourceGroupName = resourceGroup.Name,
                Location = resourceGroup.Location,
                ProvisioningState = resourceGroup.ProvisioningState,
                Tags = TagsConversionHelper.CreateTagHashtable(resourceGroup.Tags),
                ResourceId = resourceGroup.Id
            };

            if (detailed)
            {
                result.Resources = client.FilterResources(new FilterResourcesOptions { ResourceGroup = resourceGroup.Name })
                    .Select(r => r.ToPSResource(client, true)).ToList();
            }

            return result;
        }
Exemple #7
0
        public static PSResourceGroup ToPSResourceGroup(this ResourceGroupExtended resourceGroup, ResourcesClient client, bool detailed)
        {
            var result = new PSResourceGroup
            {
                ResourceGroupName = resourceGroup.Name,
                Location          = resourceGroup.Location,
                ProvisioningState = resourceGroup.ProvisioningState,
                Tags       = TagsConversionHelper.CreateTagHashtable(resourceGroup.Tags),
                ResourceId = resourceGroup.Id
            };

            if (detailed)
            {
                result.Resources = client.FilterResources(new FilterResourcesOptions {
                    ResourceGroup = resourceGroup.Name
                })
                                   .Select(r => r.ToPSResource(client, true)).ToList();
            }

            return(result);
        }