Пример #1
0
        public override void ExecuteCmdlet()
        {
            ExecutionBlock(() =>
            {
                base.ExecuteCmdlet();
                InitializeAzureBackupCmdlet(String.Empty, String.Empty);

                if (ResourceGroupName != null && Name != null)
                {
                    var backupVault = AzureBackupClient.GetVault(ResourceGroupName, Name);
                    WriteObject(VaultHelpers.GetCmdletVault(backupVault, AzureBackupClient.GetStorageTypeDetails(VaultHelpers.GetResourceGroup(backupVault.Id), backupVault.Name)));
                }
                else if (ResourceGroupName != null)
                {
                    var backupVaults = AzureBackupClient.GetVaultsInResourceGroup(ResourceGroupName);
                    WriteObject(GetCmdletVaults(backupVaults), true);
                }
                else
                {
                    var backupVaults = AzureBackupClient.GetVaults();

                    if (Name != null)
                    {
                        backupVaults = backupVaults.Where(x => x.Name.Equals(Name, StringComparison.InvariantCultureIgnoreCase));
                    }
                    WriteObject(GetCmdletVaults(backupVaults), true);
                }
            });
        }