Skip to content

Fixing 7349803 in Cmdlet Layer #328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 16, 2016
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
{
/// <summary>
/// Backup Item
/// Enables backup of an item protected by the recovery services vault.
/// Returns the corresponding job created in the service to track this backup operation.
/// </summary>
[Cmdlet(VerbsData.Backup, "AzureRmRecoveryServicesBackupItem"), OutputType(typeof(JobBase))]
public class BackupAzureRmRecoveryServicesBackupItem : RecoveryServicesBackupCmdletBase
{
[Parameter(Mandatory = true, HelpMessage = ParamHelpMsgs.Item.ProtectedItem,
/// <summary>
/// The protected item on which backup has to be enabled.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The term enabled is misleading. This commandlet takes adhoc backup. Can you rephrase it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The protected item on which backup has to be triggered

/// </summary>
[Parameter(Mandatory = true, HelpMessage = ParamHelpMsgs.Item.ProtectedItem,
ValueFromPipeline = true)]
[ValidateNotNullOrEmpty]
public ItemBase Item { get; set; }
Expand All @@ -40,13 +44,13 @@ public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();

PsBackupProviderManager providerManager =
PsBackupProviderManager providerManager =
new PsBackupProviderManager(new Dictionary<System.Enum, object>()
{
{ItemParams.Item, Item},
}, ServiceClientAdapter);

IPsBackupProvider psBackupProvider =
IPsBackupProvider psBackupProvider =
providerManager.GetProviderInstance(Item.WorkloadType, Item.BackupManagementType);
var jobResponse = psBackupProvider.TriggerBackup();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,47 @@
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
{
/// <summary>
/// Get list of containers
/// Fetches containers registered to the item according to the filters passed via the cmdlet parameters.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registered to the vault, you mean?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

/// </summary>
[Cmdlet(VerbsCommon.Get, "AzureRmRecoveryServicesBackupContainer"),
OutputType(typeof(ContainerBase), typeof(IList<ContainerBase>))]
public class GetAzureRmRecoveryServicesBackupContainer : RecoveryServicesBackupCmdletBase
{
/// <summary>
/// The type of the container(s) to be fetched.
/// </summary>
[Parameter(Mandatory = true, Position = 1, HelpMessage = ParamHelpMsgs.Container.ContainerType)]
[ValidateNotNullOrEmpty]
public ContainerType ContainerType { get; set; }

/// <summary>
/// The backup management type of the container(s) to be fetched.
/// </summary>
[Parameter(Mandatory = false, Position = 2,
HelpMessage = ParamHelpMsgs.Container.BackupManagementType)]
[ValidateNotNullOrEmpty]
[ValidateSet("AzureVM", "MARS")]
public string BackupManagementType { get; set; }

/// <summary>
/// Friendly name of the container(s) to be fetched.
/// </summary>
[Parameter(Mandatory = false, Position = 3,
HelpMessage = ParamHelpMsgs.Container.Name)]
[ValidateNotNullOrEmpty]
public string Name { get; set; }

/// <summary>
/// Resource group name of the container(s) to be fetched.
/// </summary>
[Parameter(Mandatory = false, Position = 4,
HelpMessage = ParamHelpMsgs.Container.ResourceGroupName)]
[ValidateNotNullOrEmpty]
public string ResourceGroupName { get; set; }

/// <summary>
/// Status of the registration of the container with the recovery services vault.
/// </summary>
[Parameter(Mandatory = false, Position = 5,
HelpMessage = ParamHelpMsgs.Container.Status)]
[ValidateNotNullOrEmpty]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
{
/// <summary>
/// Get list of containers
/// Fetches backup management servers registered to the recovery services vault.
/// </summary>
[Cmdlet(VerbsCommon.Get, "AzureRmRecoveryServicesBackupManagementServer"),
OutputType(typeof(BackupEngineBase), typeof(IList<BackupEngineBase>))]
public class GetAzureRmRecoveryServicesBackupManagementServer
: RecoveryServicesBackupCmdletBase
{
/// <summary>
/// Name of the backup management server(s) to be fetched.
/// </summary>
[Parameter(Mandatory = false, Position = 1,
HelpMessage = ParamHelpMsgs.Container.Name)]
[ValidateNotNullOrEmpty]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
{
/// <summary>
/// Get list of containers
/// Unregisters container from the recovery services vault.
/// </summary>
[Cmdlet(VerbsLifecycle.Unregister, "AzureRmRecoveryServicesBackupContainer")]
public class UnregisterAzureRmRecoveryServicesBackupContainer
: RecoveryServicesBackupCmdletBase
{
/// <summary>
/// Container model object to be unregistered from the vault.
/// </summary>
[Parameter(Mandatory = true, Position = 1,
HelpMessage = ParamHelpMsgs.Container.RegisteredContainer)]
[ValidateNotNullOrEmpty]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@

namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Container
{
/// <summary>
/// Unregisters the backup management server from the vault.
/// </summary>
[Cmdlet(VerbsLifecycle.Unregister, "AzureRmRecoveryServicesBackupManagementServer")]
public class UnregisterAzureRmRecoveryServicesBackupManagementServer
: RecoveryServicesBackupCmdletBase
{
/// <summary>
/// The backup management server to be unregistered from the vault.
/// </summary>
[Parameter(Mandatory = true, Position = 1,
HelpMessage = ParamHelpMsgs.Container.RegisteredContainer)]
[ValidateNotNullOrEmpty]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,25 @@
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
{
/// <summary>
/// Enable Azure Backup protection
/// Disable protection of an item protected by the recovery services vault.
/// Returns the corresponding job created in the service to track this operation.
/// </summary>
[Cmdlet(VerbsLifecycle.Disable, "AzureRmRecoveryServicesBackupProtection"),
OutputType(typeof(JobBase))]
public class DisableAzureRmRecoveryServicesBackupProtection : RecoveryServicesBackupCmdletBase
{
/// <summary>
/// The protected item whose protection needs to be disabled.
/// </summary>
[Parameter(Position = 1, Mandatory = true, HelpMessage = ParamHelpMsgs.Item.ProtectedItem,
ValueFromPipeline = true)]
[ValidateNotNullOrEmpty]
public ItemBase Item { get; set; }

/// <summary>
/// If this option is used, all the data backed up for this item will
/// also be deleted and restoring the data will not be possible.
/// </summary>
[Parameter(Position = 2, Mandatory = false,
HelpMessage = ParamHelpMsgs.Item.RemoveProtectionOption)]
public SwitchParameter RemoveRecoveryPoints
Expand All @@ -47,6 +55,9 @@ public SwitchParameter RemoveRecoveryPoints
set { DeleteBackupData = value; }
}

/// <summary>
/// Prevents the confirmation dialog when specified.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsgs.Item.ForceOption)]
public SwitchParameter Force { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
{
/// <summary>
/// Enable Azure Backup protection
/// Enable protection of an item with the recovery services vault.
/// Returns the corresponding job created in the service to track this operation.
/// </summary>
[Cmdlet(VerbsLifecycle.Enable, "AzureRmRecoveryServicesBackupProtection",
DefaultParameterSetName = AzureVMComputeParameterSet), OutputType(typeof(JobBase))]
Expand All @@ -38,26 +39,41 @@ public class EnableAzureRmRecoveryServicesBackupProtection : RecoveryServicesBac
internal const string AzureVMComputeParameterSet = "AzureVMComputeEnableProtection";
internal const string ModifyProtectionParameterSet = "ModifyProtection";

/// <summary>
/// Policy to be associated with this item as part of the protection operation.
/// </summary>
[Parameter(Position = 1, Mandatory = true, HelpMessage = ParamHelpMsgs.Policy.ProtectionPolicy)]
[ValidateNotNullOrEmpty]
public PolicyBase Policy { get; set; }

/// <summary>
/// Name of the Azure VM whose representative item needs to be protected.
/// </summary>
[Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
ParameterSetName = AzureVMClassicComputeParameterSet, HelpMessage = ParamHelpMsgs.Item.AzureVMName)]
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true,
ParameterSetName = AzureVMComputeParameterSet, HelpMessage = ParamHelpMsgs.Item.AzureVMName)]
public string Name { get; set; }

/// <summary>
/// Service name of the classic Azure VM whose representative item needs to be protected.
/// </summary>
[Parameter(Position = 3, Mandatory = true, ValueFromPipelineByPropertyName = true,
ParameterSetName = AzureVMClassicComputeParameterSet,
HelpMessage = ParamHelpMsgs.Item.AzureVMServiceName)]
public string ServiceName { get; set; }

/// <summary>
/// Resource group name of the compute Azure VM whose representative item needs to be protected.
/// </summary>
[Parameter(Position = 3, Mandatory = true, ValueFromPipelineByPropertyName = true,
ParameterSetName = AzureVMComputeParameterSet,
HelpMessage = ParamHelpMsgs.Item.AzureVMResourceGroupName)]
public string ResourceGroupName { get; set; }

/// <summary>
/// Item whose protection needs to be modified.
/// </summary>
[Parameter(Position = 4, Mandatory = true, ParameterSetName = ModifyProtectionParameterSet,
HelpMessage = ParamHelpMsgs.Item.ProtectedItem, ValueFromPipeline = true)]
[ValidateNotNullOrEmpty]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
{
/// <summary>
/// Get list of items
/// Get list of items associated with the recovery services vault
/// according to the filters passed via the cmdlet parameters.
/// </summary>
[Cmdlet(VerbsCommon.Get, "AzureRmRecoveryServicesBackupItem",
DefaultParameterSetName = GetItemsForContainerParamSet), OutputType(typeof(ItemBase),
Expand All @@ -34,28 +35,46 @@ public class GetAzureRmRecoveryServicesBackupItem : RecoveryServicesBackupCmdlet
internal const string GetItemsForContainerParamSet = "GetItemsForContainer";
internal const string GetItemsForVaultParamSet = "GetItemsForVault";

/// <summary>
/// When this option is specified, only those items which belong to this container will be returned.
/// </summary>
[Parameter(Mandatory = true, Position = 1, HelpMessage = ParamHelpMsgs.Item.Container,
ParameterSetName = GetItemsForContainerParamSet)]
[ValidateNotNullOrEmpty]
public ContainerBase Container { get; set; }

/// <summary>
/// Backup management type of the items to be returned.
/// </summary>
[Parameter(Mandatory = true, Position = 1, HelpMessage = ParamHelpMsgs.Common.BackupManagementType,
ParameterSetName = GetItemsForVaultParamSet)]
[ValidateNotNullOrEmpty]
public BackupManagementType BackupManagementType { get; set; }

/// <summary>
/// Friendly name of the item to be returned.
/// </summary>
[Parameter(Mandatory = false, Position = 2, HelpMessage = ParamHelpMsgs.Item.AzureVMName)]
[ValidateNotNullOrEmpty]
public string Name { get; set; }

/// <summary>
/// Status of protection of the item to be returned.
/// </summary>
[Parameter(Mandatory = false, Position = 3, HelpMessage = ParamHelpMsgs.Item.ProtectionStatus)]
[ValidateNotNullOrEmpty]
public ItemProtectionStatus ProtectionStatus { get; set; }

/// <summary>
/// State of protection of the item to be returned.
/// </summary>
[Parameter(Mandatory = false, Position = 4, HelpMessage = ParamHelpMsgs.Item.Status)]
[ValidateNotNullOrEmpty]
public ItemProtectionState ProtectionState { get; set; }

/// <summary>
/// Workload type of the item to be returned.
/// </summary>
[Parameter(Mandatory = true, Position = 5, HelpMessage = ParamHelpMsgs.Common.WorkloadType)]
[ValidateNotNullOrEmpty]
public WorkloadType WorkloadType { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,58 @@
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
{
/// <summary>
/// Get list of jobs
/// Gets the list of jobs associated with this recovery services vault
/// according to the filters passed via the cmdlet parameters.
/// </summary>
[Cmdlet(VerbsCommon.Get, "AzureRmRecoveryServicesBackupJob"),
OutputType(typeof(JobBase), typeof(IList<JobBase>))]
public class GetAzureRmRecoveryServicesBackupJob : RecoveryServicesBackupCmdletBase
{
/// <summary>
/// Filter value for status of job.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsgs.Job.StatusFilter, Position = 1)]
[ValidateNotNullOrEmpty]
public JobStatus? Status { get; set; }

/// <summary>
/// Filter value for type of job.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsgs.Job.OperationFilter, Position = 2)]
[ValidateNotNullOrEmpty]
public JobOperation? Operation { get; set; }

/// <summary>
/// Beginning value of time range for which jobs have to be fetched.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsgs.Job.FromFilter, Position = 3)]
[ValidateNotNull]
public DateTime? From { get; set; }

/// <summary>
/// Ending value of time range for which jobs have to be fetched.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsgs.Job.ToFilter, Position = 4)]
[ValidateNotNull]
public DateTime? To { get; set; }

/// <summary>
/// Filter value for ID of job.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsgs.Job.JobIdFilter, Position = 5)]
[ValidateNotNullOrEmpty]
public string JobId { get; set; }

/// <summary>
/// Job whose latest object has to be fetched.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsgs.Job.JobFilter, Position = 6)]
[ValidateNotNull]
public JobBase Job { get; set; }

/// <summary>
/// Filter value for backup management type of job.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsgs.Job.BackupManagementTypeFilter)]
[ValidateNotNullOrEmpty]
public BackupManagementType? BackupManagementType { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,27 @@

namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
{
/// <summary>
/// Gets detailed information about a particular job.
/// </summary>
[Cmdlet(VerbsCommon.Get, "AzureRmRecoveryServicesBackupJobDetails",
DefaultParameterSetName = JobFilterSet), OutputType(typeof(JobBase))]
public class GetAzureRmRecoveryServicesBackupJobDetails : RecoveryServicesBackupCmdletBase
{
protected const string IdFilterSet = "IdFilterSet";
protected const string JobFilterSet = "JobFilterSet";

/// <summary>
/// Job whose details are to be fetched.
/// </summary>
[Parameter(Mandatory = true, HelpMessage = ParamHelpMsgs.Job.JobFilter,
ParameterSetName = JobFilterSet, Position = 1)]
[ValidateNotNull]
public JobBase Job { get; set; }

/// <summary>
/// ID of job whose details are to be fetched.
/// </summary>
[Parameter(Mandatory = true, HelpMessage = ParamHelpMsgs.Job.JobIdFilter,
ParameterSetName = IdFilterSet, Position = 2)]
[ValidateNotNullOrEmpty]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,27 @@

namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
{
/// <summary>
/// Cancels a job. Returns the corresponding job object after this operation finishes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*after trigger of cancellation finishes. It need not cancel it successfully. It will only notify the service that a cancellation has been triggered. Please convey this in any way you like. :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cancels a job. Returns the corresponding job object after the trigger of the cancellation finishes. The job may not cancel successfully. The cmdlet will ensure that the service is notified that a cancellation has been triggered.

/// </summary>
[Cmdlet("Stop", "AzureRmRecoveryServicesBackupJob", DefaultParameterSetName = JobFilterSet),
OutputType(typeof(JobBase))]
public class StopAzureRmRecoveryServicesBackupJob : RecoveryServicesBackupCmdletBase
{
protected const string IdFilterSet = "IdFilterSet";
protected const string JobFilterSet = "JobFilterSet";

/// <summary>
/// Job which needs to be canceled.
/// </summary>
[Parameter(Mandatory = true, HelpMessage = ParamHelpMsgs.Job.StopJobJobFilter,
ParameterSetName = JobFilterSet, Position = 1)]
[ValidateNotNull]
public JobBase Job { get; set; }

/// <summary>
/// ID of the job which needs to be canceled.
/// </summary>
[Parameter(Mandatory = true, HelpMessage = ParamHelpMsgs.Job.StopJobJobIdFilter,
ParameterSetName = IdFilterSet, Position = 2)]
[ValidateNotNull]
Expand Down
Loading