generated/cmdlets/GroupCV_GroupExpanded.cs
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/powershell@4.0.708) // Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Commvault.Powershell.Cmdlets { using static Commvault.Powershell.Runtime.Extensions; using Commvault.Powershell.Runtime.PowerShell; using Commvault.Powershell.Runtime.Cmdlets; using System; /// <summary>To restore the virtual machines in vmgroup</summary> /// <remarks> /// [OpenAPI] VMGroupRestore=>POST:"/V4/VmGroup/{VmGroupId}/restore" /// </remarks> [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Group, @"CV_GroupExpanded", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(Commvault.Powershell.Models.ICreateTaskRespforBackup), typeof(Commvault.Powershell.Models.IGenericResp))] [global::Commvault.Powershell.Description(@"To restore the virtual machines in vmgroup")] [global::Commvault.Powershell.Generated] [global::Commvault.Powershell.HttpPath(Path = "/V4/VmGroup/{VmGroupId}/restore", ApiVersion = "LATEST")] public partial class GroupCV_GroupExpanded : global::System.Management.Automation.PSCmdlet, Commvault.Powershell.Runtime.IEventListener, Commvault.Powershell.Runtime.IContext { /// <summary>A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet)</summary> private global::System.Management.Automation.InvocationInfo __invocationInfo; /// <summary>VM or VMGroup restore request body</summary> private Commvault.Powershell.Models.IVMGroupRestoreRequest _body = new Commvault.Powershell.Models.VMGroupRestoreRequest(); /// <summary> /// The <see cref="global::System.Threading.CancellationTokenSource" /> for this operation. /// </summary> private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); /// <summary>A dictionary to carry over additional data for pipeline.</summary> private global::System.Collections.Generic.Dictionary<global::System.String,global::System.Object> _extensibleParameters = new System.Collections.Generic.Dictionary<string, object>(); /// <summary>A buffer to record first returned object in response.</summary> private object _firstResponse = null; /// <summary> /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. /// Two means multiple returned objects in response. /// </summary> private int _responseSize = 0; /// <summary>.</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @".", SerializedName = @"id", PossibleTypes = new [] { typeof(long) })] public long AccessNodeGroupId { get => _body.AccessNodeGroupId ?? default(long); set => _body.AccessNodeGroupId = value; } /// <summary>.</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @".", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] public string AccessNodeGroupName { get => _body.AccessNodeGroupName ?? null; set => _body.AccessNodeGroupName = value; } /// <summary>.</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @".", SerializedName = @"id", PossibleTypes = new [] { typeof(long) })] public long AccessNodeId { get => _body.AccessNodeId ?? default(long); set => _body.AccessNodeId = value; } /// <summary>.</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @".", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] public string AccessNodeName { get => _body.AccessNodeName ?? null; set => _body.AccessNodeName = value; } /// <summary>List of AWS instances that are to be restored</summary> [global::System.Management.Automation.AllowEmptyCollection] [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of AWS instances that are to be restored")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"List of AWS instances that are to be restored", SerializedName = @"awsInstanceInfoList", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IAwsInstanceInfo) })] public Commvault.Powershell.Models.IAwsInstanceInfo[] AwAwsInstanceInfoList { get => _body.AwAwsInstanceInfoList?.ToArray() ?? null /* fixedArrayOf */; set => _body.AwAwsInstanceInfoList = (value != null ? new System.Collections.Generic.List<Commvault.Powershell.Models.IAwsInstanceInfo>(value) : null); } /// <summary>Adds prefix for instance display name</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Adds prefix for instance display name")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Adds prefix for instance display name", SerializedName = @"namePrefix", PossibleTypes = new [] { typeof(string) })] public string AwNamePrefix { get => _body.AwNamePrefix ?? null; set => _body.AwNamePrefix = value; } /// <summary>Adds suffix for instance display name</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Adds suffix for instance display name")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Adds suffix for instance display name", SerializedName = @"nameSuffix", PossibleTypes = new [] { typeof(string) })] public string AwNameSuffix { get => _body.AwNameSuffix ?? null; set => _body.AwNameSuffix = value; } /// <summary>Adds prefix for VM display name</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Adds prefix for VM display name")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Adds prefix for VM display name", SerializedName = @"namePrefix", PossibleTypes = new [] { typeof(string) })] public string AzureNamePrefix { get => _body.AzureNamePrefix ?? null; set => _body.AzureNamePrefix = value; } /// <summary>Adds suffix for VM display name</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Adds suffix for VM display name")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Adds suffix for VM display name", SerializedName = @"nameSuffix", PossibleTypes = new [] { typeof(string) })] public string AzureNameSuffix { get => _body.AzureNameSuffix ?? null; set => _body.AzureNameSuffix = value; } /// <summary>List of Azure VMs that are to be restored</summary> [global::System.Management.Automation.AllowEmptyCollection] [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of Azure VMs that are to be restored")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"List of Azure VMs that are to be restored", SerializedName = @"azureVMInfoList", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IAzureVMInfo) })] public Commvault.Powershell.Models.IAzureVMInfo[] AzureVMInfoList { get => _body.AzureVMInfoList?.ToArray() ?? null /* fixedArrayOf */; set => _body.AzureVMInfoList = (value != null ? new System.Collections.Generic.List<Commvault.Powershell.Models.IAzureVMInfo>(value) : null); } /// <summary> /// Backup source information from where you want to restore. 0 (Automatic), 1 (Snap Copy), 2 (Primary), 3 to N (Aux Copy) /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Backup source information from where you want to restore. 0 (Automatic), 1 (Snap Copy), 2 (Primary), 3 to N (Aux Copy)")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Backup source information from where you want to restore. 0 (Automatic), 1 (Snap Copy), 2 (Primary), 3 to N (Aux Copy)", SerializedName = @"backupSource", PossibleTypes = new [] { typeof(long) })] public long BackupSource { get => _body.BackupSource ?? default(long); set => _body.BackupSource = value; } /// <summary>Wait for .NET debugger to attach</summary> [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } /// <summary>Accessor for cancellationTokenSource.</summary> public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } /// <summary>The reference to the client API class.</summary> public Commvault.Powershell.CommvaultPowerShell Client => Commvault.Powershell.Module.Instance.ClientAPI; /// <summary>.</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @".", SerializedName = @"id", PossibleTypes = new [] { typeof(long) })] public long DestinationId { get => _body.DestinationId ?? default(long); set => _body.DestinationId = value; } /// <summary>.</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @".", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] public string DestinationName { get => _body.DestinationName ?? null; set => _body.DestinationName = value; } /// <summary>Accessor for extensibleParameters.</summary> public global::System.Collections.Generic.IDictionary<global::System.String,global::System.Object> ExtensibleParameters { get => _extensibleParameters ; } /// <summary>Backing field for <see cref="FromTime" /> property.</summary> private string _fromTime; /// <summary> /// Restore window UTC from time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Restore window UTC from time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd")] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Restore window UTC from time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd", SerializedName = @"fromTime", PossibleTypes = new [] { typeof(string) })] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Query)] public string FromTime { get => this._fromTime; set => this._fromTime = value; } /// <summary>Adds prefix for VM display name</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Adds prefix for VM display name")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Adds prefix for VM display name", SerializedName = @"namePrefix", PossibleTypes = new [] { typeof(string) })] public string GoogleCloudNamePrefix { get => _body.GoogleCloudNamePrefix ?? null; set => _body.GoogleCloudNamePrefix = value; } /// <summary>Adds suffix for VM display name</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Adds suffix for VM display name")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Adds suffix for VM display name", SerializedName = @"nameSuffix", PossibleTypes = new [] { typeof(string) })] public string GoogleCloudNameSuffix { get => _body.GoogleCloudNameSuffix ?? null; set => _body.GoogleCloudNameSuffix = value; } /// <summary>List of Google Cloud VMs that are to be restored</summary> [global::System.Management.Automation.AllowEmptyCollection] [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of Google Cloud VMs that are to be restored")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"List of Google Cloud VMs that are to be restored", SerializedName = @"googleCloudVMInfoList", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IGoogleCloudVMInfo) })] public Commvault.Powershell.Models.IGoogleCloudVMInfo[] GoogleCloudVMInfoList { get => _body.GoogleCloudVMInfoList?.ToArray() ?? null /* fixedArrayOf */; set => _body.GoogleCloudVMInfoList = (value != null ? new System.Collections.Generic.List<Commvault.Powershell.Models.IGoogleCloudVMInfo>(value) : null); } /// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary> [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Runtime)] public Commvault.Powershell.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } /// <summary>SendAsync Pipeline Steps to be prepended to the front of the pipeline</summary> [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Runtime)] public Commvault.Powershell.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } /// <summary>Flag to set if restore is in-place or out-of-place. Defaults to false.</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Flag to set if restore is in-place or out-of-place. Defaults to false.")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Flag to set if restore is in-place or out-of-place. Defaults to false.", SerializedName = @"inPlaceRestore", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter InPlaceRestore { get => _body.InPlaceRestore; set => _body.InPlaceRestore = value; } /// <summary>Accessor for our copy of the InvocationInfo.</summary> public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// <summary>Backing field for <see cref="MediaAgentId" /> property.</summary> private string _mediaAgentId; /// <summary>Media agent id</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Media agent id")] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Media agent id", SerializedName = @"mediaAgentId", PossibleTypes = new [] { typeof(string) })] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Query)] public string MediaAgentId { get => this._mediaAgentId; set => this._mediaAgentId = value; } /// <summary>Backing field for <see cref="MediaAgentName" /> property.</summary> private string _mediaAgentName; /// <summary>Media agent name</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Media agent name")] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Media agent name", SerializedName = @"mediaAgentName", PossibleTypes = new [] { typeof(string) })] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Query)] public string MediaAgentName { get => this._mediaAgentName; set => this._mediaAgentName = value; } /// <summary> /// <see cref="Commvault.Powershell.Runtime.IEventListener" /> cancellation delegate. Stops the cmdlet when called. /// </summary> global::System.Action Commvault.Powershell.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; /// <summary><see cref="Commvault.Powershell.Runtime.IEventListener" /> cancellation token.</summary> global::System.Threading.CancellationToken Commvault.Powershell.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// <summary>Enable email notificaiton for job status. Defaults to false.</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Enable email notificaiton for job status. Defaults to false.")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Enable email notificaiton for job status. Defaults to false.", SerializedName = @"notifyOnJobCompletion", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter NotifyOnJobCompletion { get => _body.NotifyOnJobCompletion ?? default(global::System.Management.Automation.SwitchParameter); set => _body.NotifyOnJobCompletion = value; } /// <summary>Unconditionally overwrite VM during restore. Defaults to false.</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Unconditionally overwrite VM during restore. Defaults to false.")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Unconditionally overwrite VM during restore. Defaults to false.", SerializedName = @"overwriteVM", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter OverwriteVM { get => _body.OverwriteVM ?? default(global::System.Management.Automation.SwitchParameter); set => _body.OverwriteVM = value; } /// <summary> /// The instance of the <see cref="Commvault.Powershell.Runtime.HttpPipeline" /> that the remote call will use. /// </summary> public Commvault.Powershell.Runtime.HttpPipeline Pipeline { get; set; } /// <summary>Turn ON virtual machine after restore. Defaults to false.</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Turn ON virtual machine after restore. Defaults to false.")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Turn ON virtual machine after restore. Defaults to false.", SerializedName = @"powerOnVmAfterRestore", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter PowerOnVMAfterRestore { get => _body.PowerOnVMAfterRestore ?? default(global::System.Management.Automation.SwitchParameter); set => _body.PowerOnVMAfterRestore = value; } /// <summary>The URI for the proxy server to use</summary> [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Runtime)] public global::System.Uri Proxy { get; set; } /// <summary>Credentials for a proxy server to use for the remote call</summary> [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] [global::System.Management.Automation.ValidateNotNull] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Runtime)] public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } /// <summary>Use the default credentials for the proxy</summary> [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } /// <summary>Type of restore for virtual machine</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Type of restore for virtual machine")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Type of restore for virtual machine", SerializedName = @"restoreFlavour", PossibleTypes = new [] { typeof(string) })] public string RestoreFlavour { get => _body.RestoreFlavour ?? null; set => _body.RestoreFlavour = value; } /// <summary> /// Reuse the existing VM client instance of creating new one after restore. Defaults to true for inplace restore and false /// for out of place restore. /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Reuse the existing VM client instance of creating new one after restore. Defaults to true for inplace restore and false for out of place restore.")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Reuse the existing VM client instance of creating new one after restore. Defaults to true for inplace restore and false for out of place restore.", SerializedName = @"reuseVMClient", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter ReuseVMClient { get => _body.ReuseVMClient ?? default(global::System.Management.Automation.SwitchParameter); set => _body.ReuseVMClient = value; } /// <summary>Backing field for <see cref="ToTime" /> property.</summary> private global::System.DateTime _toTime; /// <summary> /// Restore window UTC to time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Restore window UTC to time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd")] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Restore window UTC to time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd", SerializedName = @"toTime", PossibleTypes = new [] { typeof(global::System.DateTime) })] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Query)] public global::System.DateTime ToTime { get => this._toTime; set => this._toTime = value; } /// <summary>Backup transport modes enum</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Backup transport modes enum")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Backup transport modes enum", SerializedName = @"transportMode", PossibleTypes = new [] { typeof(string) })] public string TransportMode { get => _body.TransportMode ?? null; set => _body.TransportMode = value; } /// <summary>Backing field for <see cref="VMGroupId" /> property.</summary> private long _vMGroupId; /// <summary>Id of the VMgroup to backup</summary> [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Id of the VMgroup to backup")] [Commvault.Powershell.Runtime.Info( Required = true, ReadOnly = false, Description = @"Id of the VMgroup to backup", SerializedName = @"VmGroupId", PossibleTypes = new [] { typeof(long) })] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Path)] public long VMGroupId { get => this._vMGroupId; set => this._vMGroupId = value; } /// <summary> /// <c>overrideOnInternalServerError</c> will be called before the regular onInternalServerError has been processed, allowing /// customization of what happens on that response. Implement this method in a partial class to enable this behavior /// </summary> /// <param name="responseMessage">the raw response message as an global::System.Net.Http.HttpResponseMessage.</param> /// <param name="response">the body result as a <see cref="Commvault.Powershell.Models.IGenericResp">Commvault.Powershell.Models.IGenericResp</see> /// from the remote call</param> /// <param name="returnNow">/// Determines if the rest of the onInternalServerError method should be processed, or if the /// method should return immediately (set to true to skip further processing )</param> partial void overrideOnInternalServerError(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> response, ref global::System.Threading.Tasks.Task<bool> returnNow); /// <summary> /// <c>overrideOnNotFound</c> will be called before the regular onNotFound has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// </summary> /// <param name="responseMessage">the raw response message as an global::System.Net.Http.HttpResponseMessage.</param> /// <param name="response">the body result as a <see cref="Commvault.Powershell.Models.IGenericResp">Commvault.Powershell.Models.IGenericResp</see> /// from the remote call</param> /// <param name="returnNow">/// Determines if the rest of the onNotFound method should be processed, or if the method should /// return immediately (set to true to skip further processing )</param> partial void overrideOnNotFound(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> response, ref global::System.Threading.Tasks.Task<bool> returnNow); /// <summary> /// <c>overrideOnOk</c> will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// </summary> /// <param name="responseMessage">the raw response message as an global::System.Net.Http.HttpResponseMessage.</param> /// <param name="response">the body result as a <see cref="Commvault.Powershell.Models.ICreateTaskRespforBackup">Commvault.Powershell.Models.ICreateTaskRespforBackup</see> /// from the remote call</param> /// <param name="returnNow">/// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing )</param> partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup> response, ref global::System.Threading.Tasks.Task<bool> returnNow); /// <summary> /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// </summary> protected override void BeginProcessing() { Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { Commvault.Powershell.Runtime.AttachDebugger.Break(); } ((Commvault.Powershell.Runtime.IEventListener)this).Signal(Commvault.Powershell.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Commvault.Powershell.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } /// <summary>Performs clean-up after the command execution</summary> protected override void EndProcessing() { if (1 ==_responseSize) { // Flush buffer WriteObject(_firstResponse); } ((Commvault.Powershell.Runtime.IEventListener)this).Signal(Commvault.Powershell.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Commvault.Powershell.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } /// <summary> /// Initializes a new instance of the <see cref="GroupCV_GroupExpanded" /> cmdlet class. /// </summary> public GroupCV_GroupExpanded() { } /// <summary>Handles/Dispatches events during the call to the REST service.</summary> /// <param name="id">The message id</param> /// <param name="token">The message cancellation token. When this call is cancelled, this should be <c>true</c></param> /// <param name="messageData">Detailed message data for the message event.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the message is completed. /// </returns> async global::System.Threading.Tasks.Task Commvault.Powershell.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func<Commvault.Powershell.Runtime.EventData> messageData) { using( NoSynchronizationContext ) { if (token.IsCancellationRequested) { return ; } switch ( id ) { case Commvault.Powershell.Runtime.Events.Verbose: { WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); return ; } case Commvault.Powershell.Runtime.Events.Warning: { WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); return ; } case Commvault.Powershell.Runtime.Events.Information: { var data = messageData(); WriteInformation(data.Message, new string[]{}); return ; } case Commvault.Powershell.Runtime.Events.Debug: { WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); return ; } case Commvault.Powershell.Runtime.Events.Error: { WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } case Commvault.Powershell.Runtime.Events.Progress: { var data = messageData(); int progress = (int)data.Value; string activityMessage, statusDescription; global::System.Management.Automation.ProgressRecordType recordType; if (progress < 100) { activityMessage = "In progress"; statusDescription = "Checking operation status"; recordType = System.Management.Automation.ProgressRecordType.Processing; } else { activityMessage = "Completed"; statusDescription = "Completed"; recordType = System.Management.Automation.ProgressRecordType.Completed; } WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) { PercentComplete = progress, RecordType = recordType }); return ; } } await Commvault.Powershell.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Commvault.Powershell.Runtime.IEventListener)this).Signal(i, t, () => Commvault.Powershell.Runtime.EventDataConverter.ConvertFrom(m()) as Commvault.Powershell.Runtime.EventData), InvocationInformation, this.ParameterSetName, null ); if (token.IsCancellationRequested) { return ; } WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); } } /// <summary>Performs execution of the command.</summary> protected override void ProcessRecord() { ((Commvault.Powershell.Runtime.IEventListener)this).Signal(Commvault.Powershell.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Commvault.Powershell.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } try { // work if (ShouldProcess($"Call remote 'VmgroupRestore' operation")) { using( var asyncCommandRuntime = new Commvault.Powershell.Runtime.PowerShell.AsyncCommandRuntime(this, ((Commvault.Powershell.Runtime.IEventListener)this).Token) ) { asyncCommandRuntime.Wait( ProcessRecordAsync(),((Commvault.Powershell.Runtime.IEventListener)this).Token); } } } catch (global::System.AggregateException aggregateException) { // unroll the inner exceptions to get the root cause foreach( var innerException in aggregateException.Flatten().InnerExceptions ) { ((Commvault.Powershell.Runtime.IEventListener)this).Signal(Commvault.Powershell.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Commvault.Powershell.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } // Write exception out to error channel. WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); } } catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) { ((Commvault.Powershell.Runtime.IEventListener)this).Signal(Commvault.Powershell.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Commvault.Powershell.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } // Write exception out to error channel. WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); } finally { ((Commvault.Powershell.Runtime.IEventListener)this).Signal(Commvault.Powershell.Runtime.Events.CmdletProcessRecordEnd).Wait(); } } /// <summary>Performs execution of the command, working asynchronously if required.</summary> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the method is completed. /// </returns> protected async global::System.Threading.Tasks.Task ProcessRecordAsync() { using( NoSynchronizationContext ) { await ((Commvault.Powershell.Runtime.IEventListener)this).Signal(Commvault.Powershell.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Commvault.Powershell.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Commvault.Powershell.Runtime.IEventListener)this).Signal(Commvault.Powershell.Runtime.Events.CmdletGetPipeline); if( ((Commvault.Powershell.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } Pipeline = Commvault.Powershell.Module.Instance.CreatePipeline(InvocationInformation, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Commvault.Powershell.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); } if (null != HttpPipelineAppend) { Pipeline.Append((this.CommandRuntime as Commvault.Powershell.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); } // get the client instance try { await ((Commvault.Powershell.Runtime.IEventListener)this).Signal(Commvault.Powershell.Runtime.Events.CmdletBeforeAPICall); if( ((Commvault.Powershell.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await this.Client.VmgroupRestore(VMGroupId, this.InvocationInformation.BoundParameters.ContainsKey("MediaAgentName") ? MediaAgentName : null, this.InvocationInformation.BoundParameters.ContainsKey("MediaAgentId") ? MediaAgentId : null, this.InvocationInformation.BoundParameters.ContainsKey("FromTime") ? FromTime : null, this.InvocationInformation.BoundParameters.ContainsKey("ToTime") ? ToTime : default(global::System.DateTime?), _body, onOk, onNotFound, onInternalServerError, this, Pipeline); await ((Commvault.Powershell.Runtime.IEventListener)this).Signal(Commvault.Powershell.Runtime.Events.CmdletAfterAPICall); if( ((Commvault.Powershell.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Commvault.Powershell.Runtime.UndeclaredResponseException urexception) { WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { VMGroupId=VMGroupId,MediaAgentName=this.InvocationInformation.BoundParameters.ContainsKey("MediaAgentName") ? MediaAgentName : null,MediaAgentId=this.InvocationInformation.BoundParameters.ContainsKey("MediaAgentId") ? MediaAgentId : null,FromTime=this.InvocationInformation.BoundParameters.ContainsKey("FromTime") ? FromTime : null,ToTime=this.InvocationInformation.BoundParameters.ContainsKey("ToTime") ? ToTime : default(global::System.DateTime?)}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); } finally { await ((Commvault.Powershell.Runtime.IEventListener)this).Signal(Commvault.Powershell.Runtime.Events.CmdletProcessRecordAsyncEnd); } } } /// <summary>Interrupts currently running code within the command.</summary> protected override void StopProcessing() { ((Commvault.Powershell.Runtime.IEventListener)this).Cancel(); base.StopProcessing(); } /// <summary> /// a delegate that is called when the remote service returns 500 (InternalServerError). /// </summary> /// <param name="responseMessage">the raw response message as an global::System.Net.Http.HttpResponseMessage.</param> /// <param name="response">the body result as a <see cref="Commvault.Powershell.Models.IGenericResp">Commvault.Powershell.Models.IGenericResp</see> /// from the remote call</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the method is completed. /// </returns> private async global::System.Threading.Tasks.Task onInternalServerError(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> response) { using( NoSynchronizationContext ) { var _returnNow = global::System.Threading.Tasks.Task<bool>.FromResult(false); overrideOnInternalServerError(responseMessage, response, ref _returnNow); // if overrideOnInternalServerError has returned true, then return right away. if ((null != _returnNow && await _returnNow)) { return ; } // onInternalServerError - response for 500 / application/json // (await response) // should be Commvault.Powershell.Models.IGenericResp var result = (await response); if (null != result) { if (0 == _responseSize) { _firstResponse = result; _responseSize = 1; } else { if (1 ==_responseSize) { // Flush buffer WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); } WriteObject(result.AddMultipleTypeNameIntoPSObject()); _responseSize = 2; } } } } /// <summary>a delegate that is called when the remote service returns 404 (NotFound).</summary> /// <param name="responseMessage">the raw response message as an global::System.Net.Http.HttpResponseMessage.</param> /// <param name="response">the body result as a <see cref="Commvault.Powershell.Models.IGenericResp">Commvault.Powershell.Models.IGenericResp</see> /// from the remote call</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the method is completed. /// </returns> private async global::System.Threading.Tasks.Task onNotFound(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> response) { using( NoSynchronizationContext ) { var _returnNow = global::System.Threading.Tasks.Task<bool>.FromResult(false); overrideOnNotFound(responseMessage, response, ref _returnNow); // if overrideOnNotFound has returned true, then return right away. if ((null != _returnNow && await _returnNow)) { return ; } // onNotFound - response for 404 / application/json // (await response) // should be Commvault.Powershell.Models.IGenericResp var result = (await response); if (null != result) { if (0 == _responseSize) { _firstResponse = result; _responseSize = 1; } else { if (1 ==_responseSize) { // Flush buffer WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); } WriteObject(result.AddMultipleTypeNameIntoPSObject()); _responseSize = 2; } } } } /// <summary>a delegate that is called when the remote service returns 200 (OK).</summary> /// <param name="responseMessage">the raw response message as an global::System.Net.Http.HttpResponseMessage.</param> /// <param name="response">the body result as a <see cref="Commvault.Powershell.Models.ICreateTaskRespforBackup">Commvault.Powershell.Models.ICreateTaskRespforBackup</see> /// from the remote call</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the method is completed. /// </returns> private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup> response) { using( NoSynchronizationContext ) { var _returnNow = global::System.Threading.Tasks.Task<bool>.FromResult(false); overrideOnOk(responseMessage, response, ref _returnNow); // if overrideOnOk has returned true, then return right away. if ((null != _returnNow && await _returnNow)) { return ; } // onOk - response for 200 / application/json // (await response) // should be Commvault.Powershell.Models.ICreateTaskRespforBackup var result = (await response); if (null != result) { if (0 == _responseSize) { _firstResponse = result; _responseSize = 1; } else { if (1 ==_responseSize) { // Flush buffer WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); } WriteObject(result.AddMultipleTypeNameIntoPSObject()); _responseSize = 2; } } } } } } |