generated/cmdlets/NewCVAlertDefinition_CreateExpanded.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>Create Alert Definitions</summary> /// <remarks> /// [OpenAPI] CreateAlertDefinitions=>POST:"/V4/AlertDefinitions" /// </remarks> [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"CVAlertDefinition_CreateExpanded", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(Commvault.Powershell.Models.IIdNameGuid))] [global::Commvault.Powershell.Description(@"Create Alert Definitions")] [global::Commvault.Powershell.Generated] [global::Commvault.Powershell.HttpPath(Path = "/V4/AlertDefinitions", ApiVersion = "LATEST")] public partial class NewCVAlertDefinition_CreateExpanded : 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>AlertDefinitonsCreate</summary> private Commvault.Powershell.Models.IAlertDefinitonsCreate _body = new Commvault.Powershell.Models.AlertDefinitonsCreate(); /// <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> /// Allows adding to, overwriting and deleting existing recipients. default is adding to existing recipients /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Allows adding to, overwriting and deleting existing recipients. default is adding to existing recipients")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Allows adding to, overwriting and deleting existing recipients. default is adding to existing recipients", SerializedName = @"recipientsOperationType", PossibleTypes = new [] { typeof(string) })] public string AlertTargetRecipientsOperationType { get => _body.AlertTargetRecipientsOperationType ?? null; set => _body.AlertTargetRecipientsOperationType = value; } /// <summary>.</summary> [global::System.Management.Automation.AllowEmptyCollection] [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 = @"sendAlertTo", PossibleTypes = new [] { typeof(string) })] public string[] AlertTargetSendAlertTo { get => _body.AlertTargetSendAlertTo?.ToArray() ?? null /* fixedArrayOf */; set => _body.AlertTargetSendAlertTo = (value != null ? new System.Collections.Generic.List<string>(value) : null); } /// <summary>Defines the category of the alert</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Defines the category of the alert")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Defines the category of the alert", SerializedName = @"category", PossibleTypes = new [] { typeof(string) })] public string AlertTypeCategory { get => _body.AlertTypeCategory ?? null; set => _body.AlertTypeCategory = value; } /// <summary>Defines the criteria of the alert</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Defines the criteria of the alert")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Defines the criteria of the alert", SerializedName = @"criteria", PossibleTypes = new [] { typeof(string) })] public string AlertTypeCriteria { get => _body.AlertTypeCriteria ?? null; set => _body.AlertTypeCriteria = value; } /// <summary>.</summary> [global::System.Management.Automation.AllowEmptyCollection] [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 = @"paramsList", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IAlertDefinitionsCriteriaParams) })] public Commvault.Powershell.Models.IAlertDefinitionsCriteriaParams[] AlertTypeParamsList { get => _body.AlertTypeParamsList?.ToArray() ?? null /* fixedArrayOf */; set => _body.AlertTypeParamsList = (value != null ? new System.Collections.Generic.List<Commvault.Powershell.Models.IAlertDefinitionsCriteriaParams>(value) : null); } /// <summary>AlertDefinitionsAssociations</summary> [global::System.Management.Automation.AllowEmptyCollection] [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "AlertDefinitionsAssociations")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"AlertDefinitionsAssociations", SerializedName = @"associations", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IAlertAssociationIdNameType1) })] public Commvault.Powershell.Models.IAlertAssociationIdNameType1[] Associations { get => _body.Associations?.ToArray() ?? null /* fixedArrayOf */; set => _body.Associations = (value != null ? new System.Collections.Generic.List<Commvault.Powershell.Models.IAlertAssociationIdNameType1>(value) : null); } /// <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.AllowEmptyCollection] [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 = @"conditions", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IConditionDetails) })] public Commvault.Powershell.Models.IConditionDetails[] EventCriterionDetailConditions { get => _body.EventCriterionDetailConditions?.ToArray() ?? null /* fixedArrayOf */; set => _body.EventCriterionDetailConditions = (value != null ? new System.Collections.Generic.List<Commvault.Powershell.Models.IConditionDetails>(value) : null); } /// <summary>Alert criteria name</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Alert criteria name")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Alert criteria name", SerializedName = @"criteriaName", PossibleTypes = new [] { typeof(string) })] public string EventCriterionDetailCriteriaName { get => _body.EventCriterionDetailCriteriaName ?? null; set => _body.EventCriterionDetailCriteriaName = value; } /// <summary>Integer value for the operation type between conditions</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Integer value for the operation type between conditions")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Integer value for the operation type between conditions", SerializedName = @"opBetweenConditions", PossibleTypes = new [] { typeof(long) })] public long EventCriterionDetailOpBetweenConditions { get => _body.EventCriterionDetailOpBetweenConditions ?? default(long); set => _body.EventCriterionDetailOpBetweenConditions = value; } /// <summary>Accessor for extensibleParameters.</summary> public global::System.Collections.Generic.IDictionary<global::System.String,global::System.Object> ExtensibleParameters { get => _extensibleParameters ; } /// <summary> /// Action that will be taken on the local entity that has the same name as the global entity that needs to be created /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Action that will be taken on the local entity that has the same name as the global entity that needs to be created")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Action that will be taken on the local entity that has the same name as the global entity that needs to be created", SerializedName = @"actionOnLocalEntity", PossibleTypes = new [] { typeof(string) })] public string GlobalConfigInfoActionOnLocalEntity { get => _body.GlobalConfigInfoActionOnLocalEntity ?? null; set => _body.GlobalConfigInfoActionOnLocalEntity = value; } /// <summary> /// Decides whether the global configuration should be applied to all the Service commcells, including the newly created ones /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Decides whether the global configuration should be applied to all the Service commcells, including the newly created ones")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Decides whether the global configuration should be applied to all the Service commcells, including the newly created ones", SerializedName = @"applyOnAllCommCells", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter GlobalConfigInfoApplyOnAllCommCells { get => _body.GlobalConfigInfoApplyOnAllCommCells ?? default(global::System.Management.Automation.SwitchParameter); set => _body.GlobalConfigInfoApplyOnAllCommCells = value; } /// <summary>List of Service CommCells where the global configuration should be applied</summary> [global::System.Management.Automation.AllowEmptyCollection] [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of Service CommCells where the global configuration should be applied")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"List of Service CommCells where the global configuration should be applied", SerializedName = @"commcells", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IGlobalConfigCommcellInfo) })] public Commvault.Powershell.Models.IGlobalConfigCommcellInfo[] GlobalConfigInfoCommcells { get => _body.GlobalConfigInfoCommcells?.ToArray() ?? null /* fixedArrayOf */; set => _body.GlobalConfigInfoCommcells = (value != null ? new System.Collections.Generic.List<Commvault.Powershell.Models.IGlobalConfigCommcellInfo>(value) : null); } /// <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 GlobalConfigInfoName { get => _body.GlobalConfigInfoName ?? null; set => _body.GlobalConfigInfoName = value; } /// <summary>The entity level at which the config has to be applied.</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The entity level at which the config has to be applied.")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"The entity level at which the config has to be applied.", SerializedName = @"scope", PossibleTypes = new [] { typeof(string) })] public string GlobalConfigInfoScope { get => _body.GlobalConfigInfoScope ?? null; set => _body.GlobalConfigInfoScope = value; } /// <summary>CommCellEntityCache filter query string using for filtering the scope</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "CommCellEntityCache filter query string using for filtering the scope")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"CommCellEntityCache filter query string using for filtering the scope", SerializedName = @"scopeFilterQuery", PossibleTypes = new [] { typeof(string) })] public string GlobalConfigInfoScopeFilterQuery { get => _body.GlobalConfigInfoScopeFilterQuery ?? null; set => _body.GlobalConfigInfoScopeFilterQuery = value; } /// <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>Accessor for our copy of the InvocationInfo.</summary> public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = 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 LocaleId { get => _body.LocaleId ?? default(long); set => _body.LocaleId = 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 LocaleName { get => _body.LocaleName ?? null; set => _body.LocaleName = 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>.</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 Name { get => _body.Name ?? null; set => _body.Name = value; } /// <summary> /// Delayed time in seconds when the notification criteria value contains delayed flag /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Delayed time in seconds when the notification criteria value contains delayed flag")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Delayed time in seconds when the notification criteria value contains delayed flag", SerializedName = @"delayTime", PossibleTypes = new [] { typeof(long) })] public long NotificationCriterionDelayTime { get => _body.NotificationCriterionDelayTime ?? default(long); set => _body.NotificationCriterionDelayTime = value; } /// <summary> /// Persisting time in seconds when the notification criteria value contains repeated flag /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Persisting time in seconds when the notification criteria value contains repeated flag")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Persisting time in seconds when the notification criteria value contains repeated flag", SerializedName = @"persistTime", PossibleTypes = new [] { typeof(long) })] public long NotificationCriterionPersistTime { get => _body.NotificationCriterionPersistTime ?? default(long); set => _body.NotificationCriterionPersistTime = value; } /// <summary> /// Bit flag indicating notification criteria value. 1 means immediate, 2 means repeated and 8 means delayed /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Bit flag indicating notification criteria value. 1 means immediate, 2 means repeated and 8 means delayed")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Bit flag indicating notification criteria value. 1 means immediate, 2 means repeated and 8 means delayed", SerializedName = @"value", PossibleTypes = new [] { typeof(long) })] public long NotificationCriterionValue { get => _body.NotificationCriterionValue ?? default(long); set => _body.NotificationCriterionValue = value; } /// <summary> /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter PassThru { get; set; } /// <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> /// Flag indicating the functionality to send individual notifications for each discovered virtual machine /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Flag indicating the functionality to send individual notifications for each discovered virtual machine")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Flag indicating the functionality to send individual notifications for each discovered virtual machine", SerializedName = @"processDiscoveredVMs", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter ProcessDiscoveredVMS { get => _body.ProcessDiscoveredVMS ?? default(global::System.Management.Automation.SwitchParameter); set => _body.ProcessDiscoveredVMS = 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>.</summary> [global::System.Management.Automation.AllowEmptyCollection] [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 = @"bcc", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IAlertTargetIdNameType1) })] public Commvault.Powershell.Models.IAlertTargetIdNameType1[] RecipientBcc { get => _body.RecipientBcc?.ToArray() ?? null /* fixedArrayOf */; set => _body.RecipientBcc = (value != null ? new System.Collections.Generic.List<Commvault.Powershell.Models.IAlertTargetIdNameType1>(value) : null); } /// <summary>.</summary> [global::System.Management.Automation.AllowEmptyCollection] [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 = @"cc", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IAlertTargetIdNameType1) })] public Commvault.Powershell.Models.IAlertTargetIdNameType1[] RecipientCc { get => _body.RecipientCc?.ToArray() ?? null /* fixedArrayOf */; set => _body.RecipientCc = (value != null ? new System.Collections.Generic.List<Commvault.Powershell.Models.IAlertTargetIdNameType1>(value) : null); } /// <summary>.</summary> [global::System.Management.Automation.AllowEmptyCollection] [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 = @"to", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IAlertTargetIdNameType1) })] public Commvault.Powershell.Models.IAlertTargetIdNameType1[] RecipientTo { get => _body.RecipientTo?.ToArray() ?? null /* fixedArrayOf */; set => _body.RecipientTo = (value != null ? new System.Collections.Generic.List<Commvault.Powershell.Models.IAlertTargetIdNameType1>(value) : null); } /// <summary> /// id of the webhook to be associated with the alert definition. Only needed incase of webhook notif selected. To get a list /// of webhooks, use api GET Webhook /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "id of the webhook to be associated with the alert definition. Only needed incase of webhook notif selected. To get a list of webhooks, use api GET Webhook")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"id of the webhook to be associated with the alert definition. Only needed incase of webhook notif selected. To get a list of webhooks, use api GET Webhook", SerializedName = @"webHookId", PossibleTypes = new [] { typeof(long) })] public long RecipientWebHookId { get => _body.RecipientWebHookId ?? default(long); set => _body.RecipientWebHookId = value; } /// <summary>Flag indicating the functionality to send individual notifications</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Flag indicating the functionality to send individual notifications")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Flag indicating the functionality to send individual notifications", SerializedName = @"sendIndividualNotifications", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter SendIndividualNotifications { get => _body.SendIndividualNotifications ?? default(global::System.Management.Automation.SwitchParameter); set => _body.SendIndividualNotifications = value; } /// <summary>Flag to indicate whether its a subscription based alert.</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Flag to indicate whether its a subscription based alert.")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Flag to indicate whether its a subscription based alert.", SerializedName = @"subscriptionBasedAlert", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter SubscriptionBasedAlert { get => _body.SubscriptionBasedAlert ?? default(global::System.Management.Automation.SwitchParameter); set => _body.SubscriptionBasedAlert = value; } /// <summary>the message template for the console notification</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "the message template for the console notification")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"the message template for the console notification", SerializedName = @"console", PossibleTypes = new [] { typeof(string) })] public string TemplateConsole { get => _body.TemplateConsole ?? null; set => _body.TemplateConsole = value; } /// <summary> /// the message template for the email notification. Contains both email subject as well as body /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "the message template for the email notification. Contains both email subject as well as body")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"the message template for the email notification. Contains both email subject as well as body", SerializedName = @"email", PossibleTypes = new [] { typeof(string) })] public string TemplateEmail { get => _body.TemplateEmail ?? null; set => _body.TemplateEmail = value; } /// <summary>the message template for the event viewer notification</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "the message template for the event viewer notification")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"the message template for the event viewer notification", SerializedName = @"eventViewer", PossibleTypes = new [] { typeof(string) })] public string TemplateEventViewer { get => _body.TemplateEventViewer ?? null; set => _body.TemplateEventViewer = value; } /// <summary>the message template for the webhook notification</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "the message template for the webhook notification")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"the message template for the webhook notification", SerializedName = @"webhook", PossibleTypes = new [] { typeof(string) })] public string TemplateWebhook { get => _body.TemplateWebhook ?? null; set => _body.TemplateWebhook = value; } /// <summary> /// the template for the workflow input entries values (empty value means the configured workflow does not need any inputs /// value) /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "the template for the workflow input entries values (empty value means the configured workflow does not need any inputs value)")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"the template for the workflow input entries values (empty value means the configured workflow does not need any inputs value)", SerializedName = @"workflowInputDetails", PossibleTypes = new [] { typeof(string) })] public string TemplateWorkflowInputDetails { get => _body.TemplateWorkflowInputDetails ?? null; set => _body.TemplateWorkflowInputDetails = 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 = @"match", PossibleTypes = new [] { typeof(string) })] public string TokenMatch { get => _body.TokenMatch ?? null; set => _body.TokenMatch = value; } /// <summary>List of rule groups</summary> [global::System.Management.Automation.AllowEmptyCollection] [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of rule groups")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"List of rule groups", SerializedName = @"ruleGroups", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.ITokenRuleGroup) })] public Commvault.Powershell.Models.ITokenRuleGroup[] TokenRuleGroups { get => _body.TokenRuleGroups?.ToArray() ?? null /* fixedArrayOf */; set => _body.TokenRuleGroups = (value != null ? new System.Collections.Generic.List<Commvault.Powershell.Models.ITokenRuleGroup>(value) : null); } /// <summary> /// id of the client on which the workflow runs (zero value means it can run on any workflow engine) /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "id of the client on which the workflow runs (zero value means it can run on any workflow engine)")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"id of the client on which the workflow runs (zero value means it can run on any workflow engine)", SerializedName = @"clientId", PossibleTypes = new [] { typeof(long) })] public long WorkflowClientId { get => _body.WorkflowClientId ?? default(long); set => _body.WorkflowClientId = value; } /// <summary> /// name of the client on which the workflow runs (empty value means it can run on any workflow engine) /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "name of the client on which the workflow runs (empty value means it can run on any workflow engine)")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"name of the client on which the workflow runs (empty value means it can run on any workflow engine)", SerializedName = @"clientName", PossibleTypes = new [] { typeof(string) })] public string WorkflowClientName { get => _body.WorkflowClientName ?? null; set => _body.WorkflowClientName = value; } /// <summary>id of the workflow which runs when the alert is triggered</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "id of the workflow which runs when the alert is triggered")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"id of the workflow which runs when the alert is triggered", SerializedName = @"id", PossibleTypes = new [] { typeof(long) })] public long WorkflowId { get => _body.WorkflowId ?? default(long); set => _body.WorkflowId = value; } /// <summary>name of the workflow which runs when the alert is triggered</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "name of the workflow which runs when the alert is triggered")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"name of the workflow which runs when the alert is triggered", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] public string WorkflowName { get => _body.WorkflowName ?? null; set => _body.WorkflowName = 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="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, 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.IIdNameGuid">Commvault.Powershell.Models.IIdNameGuid</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.IIdNameGuid> 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>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> /// Initializes a new instance of the <see cref="NewCVAlertDefinition_CreateExpanded" /> cmdlet class. /// </summary> public NewCVAlertDefinition_CreateExpanded() { } /// <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 'CreateAlertDefinitions' 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.CreateAlertDefinitions(_body, onOk, 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 { }) { 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> /// <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) { using( NoSynchronizationContext ) { var _returnNow = global::System.Threading.Tasks.Task<bool>.FromResult(false); overrideOnInternalServerError(responseMessage, ref _returnNow); // if overrideOnInternalServerError has returned true, then return right away. if ((null != _returnNow && await _returnNow)) { return ; } // onInternalServerError - response for 500 / if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) { WriteObject(true); } } } /// <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.IIdNameGuid">Commvault.Powershell.Models.IIdNameGuid</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.IIdNameGuid> 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.IIdNameGuid 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; } } } } } } |