Beispiel #1
0
        public override void ExecuteCmdlet()
        {
            switch (ParameterSetName)
            {
            case GetManagedHsmParameterSet:
                ResourceGroupName = string.IsNullOrWhiteSpace(ResourceGroupName) ? GetResourceGroupName(Name, true) : ResourceGroupName;

                if (ShouldGetByName(ResourceGroupName, Name))
                {
                    WriteObject(FilterByTag(KeyVaultManagementClient.GetManagedHsm(
                                                Name,
                                                ResourceGroupName,
                                                GraphClient), Tag));
                }
                else
                {
                    WriteObject(
                        TopLevelWildcardFilter(
                            ResourceGroupName, Name,
                            FilterByTag(
                                KeyVaultManagementClient.ListManagedHsms(ResourceGroupName, GraphClient), Tag)),
                        true);
                }
                break;

            case GetDeletedManagedHsmParameterSet:
                WriteObject(FilterByTag(KeyVaultManagementClient.GetDeletedManagedHsm(
                                            Name,
                                            Location), Tag));
                break;

            case ListDeletedManagedHsmsParameterSet:
                WriteObject(FilterByTag(
                                KeyVaultManagementClient.ListDeletedManagedHsms(),
                                Tag), true);
                break;

            default:
                throw new ArgumentException(Resources.BadParameterSetName);
            }
        }
Beispiel #2
0
        public override void ExecuteCmdlet()
        {
            ResourceGroupName = string.IsNullOrWhiteSpace(ResourceGroupName) ? GetResourceGroupName(Name, true) : ResourceGroupName;

            if (ShouldGetByName(ResourceGroupName, Name))
            {
                PSManagedHsm mhsm = KeyVaultManagementClient.GetManagedHsm(
                    Name,
                    ResourceGroupName,
                    ActiveDirectoryClient);
                WriteObject(FilterByTag(mhsm, Tag));
            }
            else
            {
                WriteObject(
                    TopLevelWildcardFilter(
                        ResourceGroupName, Name,
                        FilterByTag(
                            KeyVaultManagementClient.ListManagedHsms(ResourceGroupName, ActiveDirectoryClient), Tag)),
                    true);
            }
        }