generated/cmdlets/SetCVKuberneteAppGroupOp_UpdateViaIdentityExpanded.cs
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.4, generator: @autorest/powershell@3.0.415) // Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Commvault.Powershell.Cmdlets { using static Commvault.Powershell.Runtime.Extensions; /// <summary>API to update properties of a Kubernetes application group</summary> /// <remarks> /// [OpenAPI] UpdateKubernetesAppGroupOp=>PUT:"/V5/Kubernetes/ApplicationGroup/{applicationGroupId}" /// </remarks> [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"CVKuberneteAppGroupOp_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(Commvault.Powershell.Models.IGenericResp))] [global::Commvault.Powershell.Description(@"API to update properties of a Kubernetes application group")] [global::Commvault.Powershell.Generated] public partial class SetCVKuberneteAppGroupOp_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, Commvault.Powershell.Runtime.IEventListener { /// <summary>A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet)</summary> private global::System.Management.Automation.InvocationInfo __invocationInfo; /// <summary> /// The <see cref="global::System.Threading.CancellationTokenSource" /> for this operation. /// </summary> private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); /// <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 = @"enableBackup", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter ActivityControlEnableBackup { get => Body.ActivityControlEnableBackup ?? default(global::System.Management.Automation.SwitchParameter); set => Body.ActivityControlEnableBackup = value; } /// <summary>Backing field for <see cref="Body" /> property.</summary> private Commvault.Powershell.Models.IUpdateApplicationGroupRequest _body= new Commvault.Powershell.Models.UpdateApplicationGroupRequest(); /// <summary>Update Application Group Request</summary> private Commvault.Powershell.Models.IUpdateApplicationGroupRequest Body { get => this._body; set => this._body = 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>The reference to the client API class.</summary> public Commvault.Powershell.CommvaultPowerShell Client => Commvault.Powershell.Module.Instance.ClientAPI; /// <summary>List of applications to be added as content</summary> [global::System.Management.Automation.AllowEmptyCollection] [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of applications to be added as content")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"List of applications to be added as content", SerializedName = @"applications", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IKubernetesContentApplications) })] public Commvault.Powershell.Models.IKubernetesContentApplications[] ContentApplications { get => Body.ContentApplications ?? null /* arrayOf */; set => Body.ContentApplications = value; } /// <summary>List of label selectors to be added as content</summary> [global::System.Management.Automation.AllowEmptyCollection] [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of label selectors to be added as content")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"List of label selectors to be added as content", SerializedName = @"labelSelectors", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IKubernetesContentSelectors) })] public Commvault.Powershell.Models.IKubernetesContentSelectors[] ContentLabelSelectors { get => Body.ContentLabelSelectors ?? null /* arrayOf */; set => Body.ContentLabelSelectors = value; } /// <summary>Specifies whether content has to be overwritten or appended</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies whether content has to be overwritten or appended")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Specifies whether content has to be overwritten or appended", SerializedName = @"overwrite", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter ContentOverwrite { get => Body.ContentOverwrite ?? default(global::System.Management.Automation.SwitchParameter); set => Body.ContentOverwrite = value; } /// <summary>List of applications to be added as content</summary> [global::System.Management.Automation.AllowEmptyCollection] [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of applications to be added as content")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"List of applications to be added as content", SerializedName = @"applications", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IKubernetesContentApplications) })] public Commvault.Powershell.Models.IKubernetesContentApplications[] FilterApplications { get => Body.FilterApplications ?? null /* arrayOf */; set => Body.FilterApplications = value; } /// <summary>List of label selectors to be added as content</summary> [global::System.Management.Automation.AllowEmptyCollection] [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of label selectors to be added as content")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"List of label selectors to be added as content", SerializedName = @"labelSelectors", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.IKubernetesContentSelectors) })] public Commvault.Powershell.Models.IKubernetesContentSelectors[] FilterLabelSelectors { get => Body.FilterLabelSelectors ?? null /* arrayOf */; set => Body.FilterLabelSelectors = value; } /// <summary>Specifies whether content has to be overwritten or appended</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies whether content has to be overwritten or appended")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Specifies whether content has to be overwritten or appended", SerializedName = @"overwrite", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter FilterOverwrite { get => Body.FilterOverwrite ?? default(global::System.Management.Automation.SwitchParameter); set => Body.FilterOverwrite = value; } /// <summary>Specify whether to skip backup of stateless applications</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specify whether to skip backup of stateless applications")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Specify whether to skip backup of stateless applications", SerializedName = @"skipStatelessApps", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter FilterSkipStatelessApps { get => Body.FilterSkipStatelessApps ?? default(global::System.Management.Automation.SwitchParameter); set => Body.FilterSkipStatelessApps = 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>Backing field for <see cref="InputObject" /> property.</summary> private Commvault.Powershell.Models.ICommvaultPowerShellIdentity _inputObject; /// <summary>Identity Parameter</summary> [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Path)] public Commvault.Powershell.Models.ICommvaultPowerShellIdentity InputObject { get => this._inputObject; set => this._inputObject = 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> /// <see cref="IEventListener" /> cancellation delegate. Stops the cmdlet when called. /// </summary> global::System.Action Commvault.Powershell.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; /// <summary><see cref="IEventListener" /> cancellation token.</summary> global::System.Threading.CancellationToken Commvault.Powershell.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// <summary>Specify new name to rename an Application Group</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specify new name to rename an Application Group")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Specify new name to rename an Application Group", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] public string Name { get => Body.Name ?? null; set => Body.Name = value; } /// <summary>Define number of parallel data readers</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Define number of parallel data readers")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Define number of parallel data readers", SerializedName = @"backupStreams", PossibleTypes = new [] { typeof(long) })] public long OptionBackupStreams { get => Body.OptionBackupStreams ?? default(long); set => Body.OptionBackupStreams = value; } /// <summary>Define the backup job start time in epochs</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Define the backup job start time in epochs")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Define the backup job start time in epochs", SerializedName = @"jobStartTime", PossibleTypes = new [] { typeof(long) })] public long OptionJobStartTime { get => Body.OptionJobStartTime ?? default(long); set => Body.OptionJobStartTime = value; } /// <summary>Define setting to enable fallback to live volume backup in case of snap failure</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Define setting to enable fallback to live volume backup in case of snap failure")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Define setting to enable fallback to live volume backup in case of snap failure", SerializedName = @"onSnapFailureFallbackToLiveVolume", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter OptionOnSnapFailureFallbackToLiveVolume { get => Body.OptionOnSnapFailureFallbackToLiveVolume ?? default(global::System.Management.Automation.SwitchParameter); set => Body.OptionOnSnapFailureFallbackToLiveVolume = value; } /// <summary> /// Define setting to enable scheduling worker Pods to CV Namespace for CSI-Snapshot enabled backups /// </summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Define setting to enable scheduling worker Pods to CV Namespace for CSI-Snapshot enabled backups")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Define setting to enable scheduling worker Pods to CV Namespace for CSI-Snapshot enabled backups", SerializedName = @"scheduleWorkerToConfigNamespace", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] public global::System.Management.Automation.SwitchParameter OptionScheduleWorkerToConfigNamespace { get => Body.OptionScheduleWorkerToConfigNamespace ?? default(global::System.Management.Automation.SwitchParameter); set => Body.OptionScheduleWorkerToConfigNamespace = value; } /// <summary> /// The instance of the <see cref="Commvault.Powershell.Runtime.HttpPipeline" /> that the remote call will use. /// </summary> private Commvault.Powershell.Runtime.HttpPipeline Pipeline { get; set; } /// <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 PlanId { get => Body.PlanId ?? default(long); set => Body.PlanId = 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 PlanName { get => Body.PlanName ?? null; set => Body.PlanName = 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 = @"tags", PossibleTypes = new [] { typeof(Commvault.Powershell.Models.INameValue) })] public Commvault.Powershell.Models.INameValue[] Tags { get => Body.Tags ?? null /* arrayOf */; set => Body.Tags = 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 TimezoneId { get => Body.TimezoneId ?? default(long); set => Body.TimezoneId = 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 TimezoneName { get => Body.TimezoneName ?? null; set => Body.TimezoneName = value; } /// <summary>Define limits.cpu to set on the worker Pod</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Define limits.cpu to set on the worker Pod")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Define limits.cpu to set on the worker Pod", SerializedName = @"cpuLimits", PossibleTypes = new [] { typeof(string) })] public string WorkerResourceCpuLimits { get => Body.WorkerResourceCpuLimits ?? null; set => Body.WorkerResourceCpuLimits = value; } /// <summary>Define requests.cpu to set on the worker Pod</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Define requests.cpu to set on the worker Pod")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Define requests.cpu to set on the worker Pod", SerializedName = @"cpuRequests", PossibleTypes = new [] { typeof(string) })] public string WorkerResourceCpuRequests { get => Body.WorkerResourceCpuRequests ?? null; set => Body.WorkerResourceCpuRequests = value; } /// <summary>Define limits.memory to set on the worker Pod</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Define limits.memory to set on the worker Pod")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Define limits.memory to set on the worker Pod", SerializedName = @"memoryLimits", PossibleTypes = new [] { typeof(string) })] public string WorkerResourceMemoryLimits { get => Body.WorkerResourceMemoryLimits ?? null; set => Body.WorkerResourceMemoryLimits = value; } /// <summary>Define requests.memory to set on the worker Pod</summary> [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Define requests.memory to set on the worker Pod")] [global::Commvault.Powershell.Category(global::Commvault.Powershell.ParameterCategory.Body)] [Commvault.Powershell.Runtime.Info( Required = false, ReadOnly = false, Description = @"Define requests.memory to set on the worker Pod", SerializedName = @"memoryRequests", PossibleTypes = new [] { typeof(string) })] public string WorkerResourceMemoryRequests { get => Body.WorkerResourceMemoryRequests ?? null; set => Body.WorkerResourceMemoryRequests = value; } /// <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.IGenericResp" /> 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.IGenericResp> 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() { ((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, new[] { data.Message }); 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 ; } } 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 'UpdateKubernetesAppGroupOp' 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); 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; } // try to call with PATH parameters from Input Object if (null == InputObject.ApplicationGroupId) { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ApplicationGroupId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } await this.Client.UpdateKubernetesAppGroupOp(InputObject.ApplicationGroupId ?? default(long), Body, onOk, 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 { body=Body}) { 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> /// Intializes a new instance of the <see cref="SetCVKuberneteAppGroupOp_UpdateViaIdentityExpanded" /> cmdlet class. /// </summary> public SetCVKuberneteAppGroupOp_UpdateViaIdentityExpanded() { } /// <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 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.IGenericResp" /> 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.IGenericResp> 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.IGenericResp WriteObject((await response)); } } } } |